mirror of
https://git.joinfirefish.org/firefish/firefish.git
synced 2024-05-19 03:11:11 +02:00
29 lines
586 B
TypeScript
29 lines
586 B
TypeScript
import { defineAsyncComponent } from "vue";
|
|
import { isSignedIn, me } from "@/me";
|
|
import { i18n } from "@/i18n";
|
|
import { popup } from "@/os";
|
|
import { vibrate } from "@/scripts/vibrate";
|
|
|
|
export function pleaseLogin(path?: string) {
|
|
if (isSignedIn(me)) return;
|
|
vibrate(100);
|
|
|
|
popup(
|
|
defineAsyncComponent(() => import("@/components/MkSigninDialog.vue")),
|
|
{
|
|
autoSet: true,
|
|
message: i18n.ts.signinRequired,
|
|
},
|
|
{
|
|
cancelled: () => {
|
|
if (path) {
|
|
window.location.href = path;
|
|
}
|
|
},
|
|
},
|
|
"closed",
|
|
);
|
|
|
|
if (!path) throw new Error("Sign-in required.");
|
|
}
|