Skip to content

Commit 8aae222

Browse files
committed
use revalidate token
1 parent 2b72881 commit 8aae222

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

apps/playground/src/components/Header/ActionsDropdown/LoginDialog.tsx

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
/* eslint-disable perfectionist/sort-objects */
22

3+
import { useEffect } from 'react';
4+
35
import { asyncResultify } from '@douglasneuroinformatics/libjs';
46
import { Dialog, Form } from '@douglasneuroinformatics/libui/components';
57
import { useNotificationsStore } from '@douglasneuroinformatics/libui/hooks';
@@ -29,9 +31,14 @@ export const LoginDialog = ({ isOpen, setIsOpen }: LoginDialogProps) => {
2931
const isAuthorized = useAppStore((store) => !!store.auth);
3032
const updateSettings = useAppStore((store) => store.updateSettings);
3133
const login = useAppStore((store) => store.login);
34+
const revalidateToken = useAppStore((store) => store.revalidateToken);
3235

3336
const addNotification = useNotificationsStore((store) => store.addNotification);
3437

38+
useEffect(() => {
39+
revalidateToken();
40+
}, [isOpen]);
41+
3542
const getAdminToken = (credentials: $LoginCredentials): ResultAsync<{ accessToken: string }, string> => {
3643
return asyncResultify(async () => {
3744
try {

apps/playground/src/components/Header/ActionsDropdown/UploadBundleDialog.tsx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,14 @@ export const UploadBundleDialog = ({ isOpen, setIsOpen, onLoginRequired }: Uploa
2020

2121
const auth = useAppStore((store) => store.auth);
2222
const apiBaseUrl = useAppStore((store) => store.settings.apiBaseUrl);
23+
const revalidateToken = useAppStore((store) => store.revalidateToken);
2324

2425
const transpilerStateRef = useRef(useAppStore.getState().transpilerState);
2526

27+
useEffect(() => {
28+
revalidateToken();
29+
}, [isOpen]);
30+
2631
useEffect(() => {
2732
useAppStore.subscribe(
2833
(store) => store.transpilerState,

0 commit comments

Comments
 (0)