Skip to content

Commit

Permalink
Handle logout
Browse files Browse the repository at this point in the history
  • Loading branch information
kamranahmedse committed Apr 10, 2023
1 parent 7a2e283 commit dbe99df
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 10 deletions.
2 changes: 1 addition & 1 deletion src/components/Authenticator/authenticator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ function handleAuthenticated() {
showHideAuthElements('show');
}

function handleAuthRequired() {
export function handleAuthRequired() {
const token = Cookies.get(TOKEN_COOKIE_NAME);
if (token) {
handleAuthenticated();
Expand Down
4 changes: 3 additions & 1 deletion src/components/Navigation/navigation.ts
Original file line number Diff line number Diff line change
@@ -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() {
Expand Down
16 changes: 8 additions & 8 deletions src/components/TopicOverlay/TopicOverlay.astro
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down

0 comments on commit dbe99df

Please sign in to comment.