hippofish/packages/client/src/pages/authorize_interaction.vue
Linca 59f9a1620f feat: add authorize_interaction page
Co-authored-by: naskya <m@naskya.net>
Co-authored-by: Lhcfl <Lhcfl@outlook.com>
2024-03-18 15:45:24 +00:00

38 lines
881 B
Vue

<template>
<MkLoading v-if="!err" />
<XNotFound v-else />
</template>
<script lang="ts" setup>
import * as os from "@/os";
import { useRouter } from "@/router";
import { userPage } from "@/filters/user";
import { notePage } from "@/filters/note";
import { onMounted, ref, defineAsyncComponent } from "vue";
const XNotFound = defineAsyncComponent(() => import("./not-found.vue"));
const err = ref(false);
const urlParams = new URLSearchParams(window.location.search);
const uri = urlParams.get("uri");
const router = useRouter();
onMounted(() => {
os.api("ap/show", { uri })
.then((res) => {
switch (res.type) {
case "User":
router.push(userPage(res.object));
break;
case "Note":
router.push(notePage(res.object));
break;
default:
err.value = true;
break;
}
})
.catch((error) => {
err.value = true;
});
});
</script>