File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 44 */
55
66import { getAdminUserKeyAPI , testAdminConnectionAPI } from './api' ;
7+ import { authStore } from './stores/AuthStore' ;
78
89const sdk = window . JSSDK ;
910
@@ -43,6 +44,12 @@ async function getToken(code: string): Promise<boolean> {
4344 } ;
4445 await sdk . storage . setItem ( 'plugin-admin-local-auth' , JSON . stringify ( localAuthData ) ) ;
4546
47+ // 同步更新 authStore 缓存,确保请求拦截器能立即获取到新的 Token
48+ await authStore . setPluginAdminAuthData ( {
49+ user_access_token : localAuthData . user_access_token ,
50+ user_key : localAuthData . user_key
51+ } ) ;
52+
4653 return true ;
4754 } catch ( error ) {
4855 console . error ( 'Failed to get token:' , error ) ;
Original file line number Diff line number Diff line change 44 */
55
66import { getUserKeyAPI , testUserConnectionAPI } from './api' ;
7+ import { authStore } from './stores/AuthStore' ;
78
89const sdk = window . JSSDK ;
910
@@ -43,6 +44,12 @@ async function getToken(code: string): Promise<boolean> {
4344 } ;
4445 await sdk . storage . setItem ( 'plugin-local-auth' , JSON . stringify ( localAuthData ) ) ;
4546
47+ // 同步更新 authStore 缓存,确保请求拦截器能立即获取到新的 Token
48+ await authStore . setPluginUserAuthData ( {
49+ user_access_token : localAuthData . user_access_token ,
50+ user_key : localAuthData . user_key
51+ } ) ;
52+
4653 return true ;
4754 } catch ( error ) {
4855 console . error ( 'Failed to get token:' , error ) ;
You can’t perform that action at this time.
0 commit comments