diff --git a/apps/voko-web/src/api.js b/apps/voko-web/src/api.js index babe169..94b0492 100644 --- a/apps/voko-web/src/api.js +++ b/apps/voko-web/src/api.js @@ -34,7 +34,7 @@ export async function api(method, path, body, idempotencyKey) { // 登录已过期:清掉 token 回登录页,登录后回到当前页(否则页面只会空白)。 if (response.status === 401 && token !== null) { setToken(null) - location.assign(`/login?next=${encodeURIComponent(location.pathname)}`) + window.location.assign(`/login?next=${encodeURIComponent(window.location.pathname)}`) } const json = await response.json() if (!response.ok) throw new Error(json.error.message)