Files
misskey/packages/client/src/scripts/please-login.ts
Andreas Nedbal 1d9a4f68f4 Refactor pleaseLogin to show a sign-in dialog (#8630)
* refactor(client): refactor pleaseLogin to show a sign-in dialog

* Apply review suggestions from @Johann150

Co-authored-by: Johann150 <johann@qwertqwefsday.eu>

Co-authored-by: Johann150 <johann@qwertqwefsday.eu>
Co-authored-by: syuilo <Syuilotan@yahoo.co.jp>
2022-05-19 20:28:08 +09:00

22 lines
471 B
TypeScript

import { defineAsyncComponent } from 'vue';
import { $i } from '@/account';
import { i18n } from '@/i18n';
import { popup } from '@/os';
export function pleaseLogin(path?: string) {
if ($i) return;
popup(defineAsyncComponent(() => import('@/components/signin-dialog.vue')), {
autoSet: true,
message: i18n.ts.signinRequired
}, {
cancelled: () => {
if (path) {
window.location.href = path;
}
},
}, 'closed');
throw new Error('signin required');
}