File tree Expand file tree Collapse file tree 5 files changed +6
-23
lines changed
Expand file tree Collapse file tree 5 files changed +6
-23
lines changed Original file line number Diff line number Diff line change @@ -65,14 +65,8 @@ const useApplicationStore = defineStore({
6565 applicationApi
6666 . postAppAuthentication ( token , loading )
6767 . then ( ( res ) => {
68- const accessTokenObjStr = localStorage . getItem ( 'accessTokenObj' )
69- if ( accessTokenObjStr ) {
70- const accessTokenObj = JSON . parse ( accessTokenObjStr )
71- accessTokenObj [ token ] = res . data
72- localStorage . setItem ( 'accessTokenObj' , JSON . stringify ( accessTokenObj ) )
73- } else {
74- localStorage . setItem ( 'accessTokenObj' , JSON . stringify ( { [ token ] : res . data } ) )
75- }
68+ localStorage . setItem ( 'accessToken' , res . data )
69+ sessionStorage . setItem ( 'accessToken' , res . data )
7670 resolve ( res )
7771 } )
7872 . catch ( ( error ) => {
Original file line number Diff line number Diff line change @@ -16,8 +16,7 @@ const useUserStore = defineStore({
1616 userType : 1 ,
1717 userInfo : null ,
1818 token : '' ,
19- version : '' ,
20- accessToken : ''
19+ version : ''
2120 } ) ,
2221 actions : {
2322 getToken ( ) : String | null {
@@ -27,13 +26,9 @@ const useUserStore = defineStore({
2726 return this . userType === 1 ? localStorage . getItem ( 'token' ) : this . getAccessToken ( )
2827 } ,
2928 getAccessToken ( ) {
30- const accessTokenObjStr = localStorage . getItem ( 'accessTokenObj' )
31- if ( accessTokenObjStr && this . accessToken ) {
32- const accessTokenObj = JSON . parse ( accessTokenObjStr )
33- const result = accessTokenObj [ this . accessToken ]
34- if ( result ) {
35- return result
36- }
29+ const accessToken = sessionStorage . getItem ( 'accessToken' )
30+ if ( accessToken ) {
31+ return accessToken
3732 }
3833 return localStorage . getItem ( 'accessToken' )
3934 } ,
@@ -55,9 +50,6 @@ const useUserStore = defineStore({
5550 changeUserType ( num : number ) {
5651 this . userType = num
5752 } ,
58- setAccessToken ( accessToken : string ) {
59- this . accessToken = accessToken
60- } ,
6153
6254 async asyncGetVersion ( ) {
6355 return UserApi . getVersion ( ) . then ( ( ok ) => {
Original file line number Diff line number Diff line change @@ -54,7 +54,6 @@ function getProfile() {
5454
5555onMounted (() => {
5656 user .changeUserType (2 )
57- user .setAccessToken (accessToken )
5857 getAccessToken (accessToken )
5958})
6059 </script >
Original file line number Diff line number Diff line change @@ -199,7 +199,6 @@ function refresh(id: string) {
199199
200200onMounted (() => {
201201 user .changeUserType (2 )
202- user .setAccessToken (accessToken )
203202 getAccessToken (accessToken )
204203})
205204 </script >
Original file line number Diff line number Diff line change @@ -286,7 +286,6 @@ async function exportHTML(): Promise<void> {
286286
287287onMounted (() => {
288288 user .changeUserType (2 )
289- user .setAccessToken (accessToken )
290289 getAccessToken (accessToken )
291290})
292291 </script >
You can’t perform that action at this time.
0 commit comments