Merge branch 'signout-to-welcome-page' into swn

This commit is contained in:
tamaina
2021-08-24 14:20:00 +09:00
26 changed files with 136 additions and 34 deletions

View File

@@ -1,18 +1,15 @@
// SafariがBroadcastChannel未実装なのでライブラリを使う
import { BroadcastChannel } from 'broadcast-channel';
export const reloadChannel = new BroadcastChannel<boolean>('reload');
export const reloadChannel = new BroadcastChannel<string>('reload');
// BroadcastChannelを用いて、クライアントが一斉にreloadするようにします。
export function unisonReload(redirectToRoot: boolean = false) {
reloadChannel.postMessage(!!redirectToRoot);
reload();
}
export function reload(redirectToRoot: boolean = false) {
if (redirectToRoot) {
location.href = '/';
export function unisonReload(path?: string) {
if (path !== undefined) {
reloadChannel.postMessage(path);
location.href = path;
} else {
reloadChannel.postMessage('reload');
location.reload();
}
}