Merge branch 'login-id' into swn

This commit is contained in:
tamaina 2021-10-29 14:21:01 +09:00
commit 6009ebbff0
2 changed files with 4 additions and 4 deletions

View file

@ -37,7 +37,7 @@ import { isMobile } from '@client/scripts/is-mobile';
import { initializeSw } from '@client/scripts/initialize-sw';
import { reloadChannel } from '@client/scripts/unison-reload';
import { reactionPicker } from '@client/scripts/reaction-picker';
import { deleteLoginId } from '@client/scripts/login-id';
import { getUrlWithoutLoginId } from '@client/scripts/login-id';
import { getAccountFromId } from '@client/scripts/get-account-from-id';
console.info(`Misskey v${version}`);
@ -126,7 +126,7 @@ const params = new URLSearchParams(location.search);
const loginId = params.get('loginId');
if (loginId) {
const target = deleteLoginId(location.href);
const target = getUrlWithoutLoginId(location.href);
if (!$i || $i.id !== loginId) {
const account = await getAccountFromId(loginId);

View file

@ -1,10 +1,10 @@
export function appendLoginId(url: string, loginId: string) {
export function getUrlWithLoginId(url: string, loginId: string) {
const u = new URL(url, origin);
u.searchParams.append('loginId', loginId);
return u.toString();
}
export function deleteLoginId(url: string) {
export function getUrlWithoutLoginId(url: string) {
const u = new URL(url);
u.searchParams.delete('loginId');
return u.toString();