Expand seller store functionality
This commit is contained in:
@@ -1,16 +1,19 @@
|
||||
/**
|
||||
* access token 仅在内存中短暂持有(docs/api/conventions.md §1),
|
||||
* 不得写入 localStorage 等持久化存储;页面刷新后由 /auth/refresh 通过
|
||||
* HttpOnly cookie 恢复会话(接入会话恢复逻辑时实现)。
|
||||
* 正常 Web 调用仍只从内存读取 token。为自托管采集插件互操作,维护者
|
||||
* 明确批准将当前短期 token 镜像到本站 localStorage;见
|
||||
* docs/project/extension-login-alternatives.md,不得扩大到其他调用方。
|
||||
*/
|
||||
let accessToken: string | null = null;
|
||||
export const extensionWebAccessStorageKey = 'atlas.extension.web-access';
|
||||
|
||||
export const authToken = {
|
||||
get: () => accessToken,
|
||||
set: (token: string) => {
|
||||
accessToken = token;
|
||||
localStorage.setItem(extensionWebAccessStorageKey, JSON.stringify({ accessToken: token }));
|
||||
},
|
||||
clear: () => {
|
||||
accessToken = null;
|
||||
localStorage.removeItem(extensionWebAccessStorageKey);
|
||||
},
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user