Skip to content
Snippets Groups Projects
please-login.ts 482 B
Newer Older
import { defineAsyncComponent } from 'vue';
syuilo's avatar
syuilo committed
import { $i } from '@/account';
import { i18n } from '@/i18n';
import { popup } from '@/os';
export function pleaseLogin(path?: string) {
syuilo's avatar
syuilo committed
	if ($i) return;
syuilo's avatar
syuilo committed

	popup(defineAsyncComponent(() => import('@/components/signin-dialog.vue')), {
		autoSet: true,
		message: i18n.ts.signinRequired
	}, {
		cancelled: () => {
			if (path) {
				window.location.href = path;
			}
		},
	}, 'closed');
	if (!path) throw new Error('signin required');
syuilo's avatar
syuilo committed
}