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>
This commit is contained in:
@ -1,14 +1,21 @@
|
||||
import { defineAsyncComponent } from 'vue';
|
||||
import { $i } from '@/account';
|
||||
import { i18n } from '@/i18n';
|
||||
import { alert } from '@/os';
|
||||
import { popup } from '@/os';
|
||||
|
||||
export function pleaseLogin() {
|
||||
export function pleaseLogin(path?: string) {
|
||||
if ($i) return;
|
||||
|
||||
alert({
|
||||
title: i18n.ts.signinRequired,
|
||||
text: null
|
||||
});
|
||||
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');
|
||||
}
|
||||
|
Reference in New Issue
Block a user