summaryrefslogtreecommitdiff
path: root/packages/client/src/scripts
diff options
context:
space:
mode:
authorAndreas Nedbal <github-bf215181b5140522137b3d4f6b73544a@desu.email>2022-05-19 13:28:08 +0200
committerGitHub <noreply@github.com>2022-05-19 20:28:08 +0900
commit1d9a4f68f472def57c259290cfacb7b7d238e490 (patch)
treef63520add50095632bfccd078eebc8ab81fc997a /packages/client/src/scripts
parentchore(deps): bump copy-props from 2.0.4 to 2.0.5 (#8709) (diff)
downloadsharkey-1d9a4f68f472def57c259290cfacb7b7d238e490.tar.gz
sharkey-1d9a4f68f472def57c259290cfacb7b7d238e490.tar.bz2
sharkey-1d9a4f68f472def57c259290cfacb7b7d238e490.zip
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>
Diffstat (limited to 'packages/client/src/scripts')
-rw-r--r--packages/client/src/scripts/please-login.ts19
1 files changed, 13 insertions, 6 deletions
diff --git a/packages/client/src/scripts/please-login.ts b/packages/client/src/scripts/please-login.ts
index aeaafa124b..e21a6d2ed3 100644
--- a/packages/client/src/scripts/please-login.ts
+++ b/packages/client/src/scripts/please-login.ts
@@ -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');
}