Skip to content

Commit 00c1561

Browse files
authored
[Fix][UI] Fix login required when opening new tab (#571)
1 parent 0fdc70d commit 00c1561

5 files changed

Lines changed: 6 additions & 6 deletions

File tree

datavines-ui/src/App/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ function App() {
3232
<Route key="/main" path="/main">
3333
<Main />
3434
</Route>
35-
<Redirect from="/" to={shareData.sessionGet(DV_STORAGE_LOGIN)? '/main' : '/login'} />
35+
<Redirect from="/" to={shareData.storageGet(DV_STORAGE_LOGIN)? '/main' : '/login'} />
3636
</Switch>
3737
</Suspense>
3838
</Router>

datavines-ui/src/hooks/useMainInitData/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import { useUserActions } from '@/store';
77
export default () => {
88
const { setLoginInfo } = useUserActions();
99
useMount(() => {
10-
const loginInfo = shareData.sessionGet(DV_STORAGE_LOGIN) as ILoginInfo;
10+
const loginInfo = shareData.storageGet(DV_STORAGE_LOGIN) as ILoginInfo;
1111
setLoginInfo(loginInfo || {});
1212
});
1313
};

datavines-ui/src/http/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ const refreshToken = (newToken: string) => {
1717
type: 'save_login',
1818
payload: newLoginInfo,
1919
});
20-
shareData.sessionSet(DV_STORAGE_LOGIN, newLoginInfo);
20+
shareData.storageSet(DV_STORAGE_LOGIN, newLoginInfo);
2121
});
2222
}
2323
};

datavines-ui/src/utils/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,9 @@ export const download = (blob: any, fileName?: string) => {
2424
};
2525

2626
export const getDefaultWorkspaceId = () => {
27-
const loginInfo = shareData.sessionGet(DV_STORAGE_LOGIN) || {};
27+
const loginInfo = shareData.storageGet(DV_STORAGE_LOGIN) || {};
2828
if (loginInfo.id) {
29-
const workspaceId = shareData.sessionGet(`${DV_WORKSPACE_ID}_${loginInfo.id}`);
29+
const workspaceId = shareData.storageGet(`${DV_WORKSPACE_ID}_${loginInfo.id}`);
3030
return workspaceId;
3131
}
3232
return undefined;

datavines-ui/src/view/Login/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ const Login = () => {
2828
try {
2929
setLoading(true);
3030
const res = await $http.post('/login', values, { showWholeData: true });
31-
shareData.sessionSet(DV_STORAGE_LOGIN, {
31+
shareData.storageSet(DV_STORAGE_LOGIN, {
3232
...(res.data),
3333
token: res.token,
3434
});

0 commit comments

Comments
 (0)