|
|
@ -1,8 +1,15 @@ |
|
|
|
import Cookies from 'js-cookie'; |
|
|
|
import Cookies from 'js-cookie'; |
|
|
|
import { TOKEN_COOKIE_NAME } from "../../lib/jwt"; |
|
|
|
import { TOKEN_COOKIE_NAME } from '../../lib/jwt'; |
|
|
|
|
|
|
|
|
|
|
|
export function logout() { |
|
|
|
export function logout() { |
|
|
|
Cookies.remove(TOKEN_COOKIE_NAME); |
|
|
|
Cookies.remove(TOKEN_COOKIE_NAME); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// @FIXME: fix the domain name in the cookie created by the API
|
|
|
|
|
|
|
|
Cookies.remove(TOKEN_COOKIE_NAME, { |
|
|
|
|
|
|
|
path: '/', |
|
|
|
|
|
|
|
domain: 'api.roadmap.sh', |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
// Reloading will automatically redirect the user if required
|
|
|
|
// Reloading will automatically redirect the user if required
|
|
|
|
window.location.reload(); |
|
|
|
window.location.reload(); |
|
|
|
} |
|
|
|
} |
|
|
@ -36,10 +43,10 @@ function bindEvents() { |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
document |
|
|
|
document |
|
|
|
.querySelector('[data-command-menu]') |
|
|
|
.querySelector('[data-command-menu]') |
|
|
|
?.addEventListener('click', () => { |
|
|
|
?.addEventListener('click', () => { |
|
|
|
window.dispatchEvent(new CustomEvent('command.k')); |
|
|
|
window.dispatchEvent(new CustomEvent('command.k')); |
|
|
|
}); |
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
bindEvents(); |
|
|
|
bindEvents(); |
|
|
|