feat(client): 获取url参数后更新url

This commit is contained in:
dayjoy
2025-09-12 10:49:53 +08:00
parent 0d4a938c00
commit 9a7549d18c

View File

@@ -67,8 +67,22 @@ export const clearGroupId = (): void => {
export const handleAuthTokenAndGroupIdFromUrl = (): void => { export const handleAuthTokenAndGroupIdFromUrl = (): void => {
const tokenFromUrl = getAuthTokenFromUrl(); const tokenFromUrl = getAuthTokenFromUrl();
const groupIdFromUrl = getGroupIdFromUrl(); const groupIdFromUrl = getGroupIdFromUrl();
if (tokenFromUrl && groupIdFromUrl) {
let updated = false;
if (tokenFromUrl) {
saveAuthToken(tokenFromUrl); saveAuthToken(tokenFromUrl);
updated = true;
}
if (groupIdFromUrl) {
saveGroupId(groupIdFromUrl); saveGroupId(groupIdFromUrl);
updated = true;
}
// Clean URL if we consumed any param
if (updated) {
const url = new URL(window.location.href);
url.searchParams.delete('authToken');
url.searchParams.delete('groupId');
window.history.replaceState(null, '', url.toString());
} }
}; };