Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(desktop): add appToken for providers & fix ssr error (#4566)
- Loading branch information
1 parent
b766fb5
commit 8f135d6
Showing
15 changed files
with
73 additions
and
141 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import { UserInfo } from '@/api/auth'; | ||
import { jwtDecode } from 'jwt-decode'; | ||
import { AccessTokenPayload } from '@/types/token'; | ||
import useSessionStore from '@/stores/session'; | ||
|
||
export const sessionConfig = async ({ | ||
token, | ||
kubeconfig, | ||
appToken | ||
}: { | ||
token: string; | ||
kubeconfig: string; | ||
appToken: string; | ||
}) => { | ||
const store = useSessionStore.getState(); | ||
store.setToken(token); | ||
const infoData = await UserInfo(); | ||
const payload = jwtDecode<AccessTokenPayload>(token); | ||
store.setSession({ | ||
token: appToken, | ||
user: { | ||
k8s_username: payload.userCrName, | ||
name: infoData.data?.info.nickname || '', | ||
avatar: infoData.data?.info.avatarUri || '', | ||
nsid: payload.workspaceId, | ||
ns_uid: payload.workspaceUid, | ||
userCrUid: payload.userCrUid, | ||
userId: payload.userId, | ||
userUid: payload.userUid | ||
}, | ||
kubeconfig | ||
}); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters