规范:统一自有源码中文注释和中文提交约定
This commit is contained in:
1 parent
bdb9b00b6e
commit
83b7484558
17 files changed
+39
-36
No files matched your search
+3
-3
@@ -244,7 +244,7 @@ async function withRequestDeadline(
|
||||
}, duration);
|
||||
});
|
||||
try {
|
||||
// The deadline also covers response-body decoding and any purchase preflight.
|
||||
// 截止时间也覆盖响应体解码和购买预检。
|
||||
return await Promise.race([
|
||||
Promise.resolve().then(() => operation(controller.signal)),
|
||||
deadline,
|
||||
@@ -359,7 +359,7 @@ function useApi() {
|
||||
|
||||
/** JSON 请求主路径:固定本次身份和请求体 → 必要时限购预检 → 请求 → 验证信封。 */
|
||||
async function request(method, path, options = {}) {
|
||||
// Capture identity before the first await, including when logout clears it immediately.
|
||||
// 在首次 await 前捕获身份,包括退出登录立即清除身份的情况。
|
||||
const requestToken = auth.token;
|
||||
const headers = { Accept: "application/json" };
|
||||
if (requestToken) headers.Authorization = `Bearer ${requestToken}`;
|
||||
@@ -876,7 +876,7 @@ const useAuth = defineStore("auth", () => {
|
||||
|
||||
// 本地退出立即生效,不等待远端吊销成功;请求已同步捕获旧 Bearer,不会误用新身份。
|
||||
function logout() {
|
||||
// request() captures the original Bearer synchronously; remote revocation never owns local logout.
|
||||
// request() 同步捕获原始 Bearer 凭证;远端吊销不决定本地退出是否生效。
|
||||
const revocation = useApi().post("/logout");
|
||||
clear();
|
||||
void revocation.catch(() => {});
|
||||
|
||||
Reference in new issue
Block a user