Handle logout

pull/3813/head
Kamran Ahmed 2 years ago
parent 7a2e283281
commit dbe99df82c
  1. 2
      src/components/Authenticator/authenticator.ts
  2. 4
      src/components/Navigation/navigation.ts
  3. 2
      src/components/TopicOverlay/TopicOverlay.astro

@ -45,7 +45,7 @@ function handleAuthenticated() {
showHideAuthElements('show'); showHideAuthElements('show');
} }
function handleAuthRequired() { export function handleAuthRequired() {
const token = Cookies.get(TOKEN_COOKIE_NAME); const token = Cookies.get(TOKEN_COOKIE_NAME);
if (token) { if (token) {
handleAuthenticated(); handleAuthenticated();

@ -1,9 +1,11 @@
import Cookies from 'js-cookie'; import Cookies from 'js-cookie';
import { TOKEN_COOKIE_NAME } from '../../lib/constants'; import { TOKEN_COOKIE_NAME } from '../../lib/constants';
import { handleAuthRequired } from '../Authenticator/authenticator';
function logout() { function logout() {
Cookies.remove(TOKEN_COOKIE_NAME); Cookies.remove(TOKEN_COOKIE_NAME);
window.location.href = '/'; handleAuthRequired();
window.location.reload();
} }
function bindEvents() { function bindEvents() {

@ -38,7 +38,6 @@ const { contentContributionLink } = Astro.props;
<Icon icon='check' /> <Icon icon='check' />
<span class='ml-2'>Mark as Done</span> <span class='ml-2'>Mark as Done</span>
</button> </button>
</div>
<button <button
id='mark-topic-pending' id='mark-topic-pending'
@ -47,6 +46,7 @@ const { contentContributionLink } = Astro.props;
<Icon icon='reset' /> <Icon icon='reset' />
<span class='ml-2'>Mark as Pending</span> <span class='ml-2'>Mark as Pending</span>
</button> </button>
</div>
<button <button
type='button' type='button'

Loading…
Cancel
Save