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. 16
      src/components/TopicOverlay/TopicOverlay.astro

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

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

@ -38,15 +38,15 @@ const { contentContributionLink } = Astro.props;
<Icon icon='check' />
<span class='ml-2'>Mark as Done</span>
</button>
</div>
<button
id='mark-topic-pending'
class='inline-flex hidden items-center rounded-md bg-red-600 p-1 px-2 text-sm text-white hover:bg-red-700'
>
<Icon icon='reset' />
<span class='ml-2'>Mark as Pending</span>
</button>
<button
id='mark-topic-pending'
class='inline-flex hidden items-center rounded-md bg-red-600 p-1 px-2 text-sm text-white hover:bg-red-700'
>
<Icon icon='reset' />
<span class='ml-2'>Mark as Pending</span>
</button>
</div>
<button
type='button'

Loading…
Cancel
Save