Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
export const logout = () => {
destroyCookie(undefined, 'codeleakUser')
destroyCookie(undefined, 'codeleakAuthToken')
// window.localStorage.setItem("logout", Date.now()guardialo on successguardialo on success);
console.log('Logged out. Redirecting')
Router.push('/')
message.success('Successfully logged out!')
}
export const logout = () => {
destroyCookie(undefined, 'codeleakUser')
destroyCookie(undefined, 'codeleakAuthToken')
// window.localStorage.setItem("logout", Date.now()guardialo on successguardialo on success);
console.log('Logged out. Redirecting')
Router.push('/')
message.success('Successfully logged out!')
}
static async getInitialProps(context) {
const {loggedInUser} = await checkLoggedIn(context.apolloClient);
if (!loggedInUser.user) {
// If not signed in, send them somewhere more useful
redirect(context, "/");
}
destroyCookie(context, "token");
/* https://www.apollographql.com/docs/react/recipes/authentication.html#login-logout */
context.apolloClient.resetStore().then(() => {
redirect({}, "/");
});
return {loggedInUser};
}
return axios.get(host + '/api/v1/user/logout').then(res => {
if (res && res.data) {
destroyCookie({}, 'loggedIn')
Router.push('/login')
window.location.href = '/login'
}
return res.data
})
}
componentDidMount() {
destroyCookie(undefined, 'codeleakUser')
destroyCookie(undefined, 'codeleakAuthToken')
}
componentDidMount() {
destroyCookie(undefined, 'codeleakUser')
destroyCookie(undefined, 'codeleakAuthToken')
}