forked from mirror/misskey
Redirect to welcome page when sign out
This commit is contained in:
parent
c3b55b6849
commit
b67d3f88b6
@ -47,7 +47,7 @@ export async function signout() {
|
||||
document.cookie = `igi=; path=/`;
|
||||
|
||||
if (accounts.length > 0) login(accounts[0].token);
|
||||
else unisonReload();
|
||||
else unisonReload('/');
|
||||
}
|
||||
|
||||
export async function getAccounts(): Promise<{ id: Account['id'], token: Account['token'] }[]> {
|
||||
|
@ -89,7 +89,10 @@ if (defaultStore.state.reportError && !_DEV_) {
|
||||
document.addEventListener('touchend', () => {}, { passive: true });
|
||||
|
||||
// 一斉リロード
|
||||
reloadChannel.addEventListener('message', () => location.reload());
|
||||
reloadChannel.addEventListener('message', path => {
|
||||
if (path === 'reload')
|
||||
location.reload()
|
||||
});
|
||||
|
||||
//#region SEE: https://css-tricks.com/the-trick-to-viewport-units-on-mobile/
|
||||
// TODO: いつの日にか消したい
|
||||
|
@ -1,10 +1,15 @@
|
||||
// SafariがBroadcastChannel未実装なのでライブラリを使う
|
||||
import { BroadcastChannel } from 'broadcast-channel';
|
||||
|
||||
export const reloadChannel = new BroadcastChannel<'reload'>('reload');
|
||||
export const reloadChannel = new BroadcastChannel<string>('reload');
|
||||
|
||||
// BroadcastChannelを用いて、クライアントが一斉にreloadするようにします。
|
||||
export function unisonReload() {
|
||||
reloadChannel.postMessage('reload');
|
||||
location.reload();
|
||||
export function unisonReload(path?: string) {
|
||||
if (path !== undefined) {
|
||||
reloadChannel.postMessage(path);
|
||||
location.href = path;
|
||||
} else {
|
||||
reloadChannel.postMessage('reload');
|
||||
location.reload();
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user