色々
This commit is contained in:
@@ -0,0 +1,89 @@
|
||||
<template>
|
||||
<Progress
|
||||
v-if="isProcessing"
|
||||
:size="24"
|
||||
class="processing-progress"
|
||||
/>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
.processing-progress {
|
||||
margin: auto;
|
||||
}
|
||||
</style>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { useRoute, useRouter } from "vue-router";
|
||||
import { account, serverInfo } from "@/lib/account";
|
||||
import client from "@/lib/client";
|
||||
import { createModal } from "@/lib/modal";
|
||||
import GoHomeError from "@/components/Modal/GoHomeError.vue";
|
||||
import { ref } from "vue";
|
||||
import Progress from "@/components/Progress.vue";
|
||||
import { title } from "@/lib/router";
|
||||
|
||||
const route = useRoute();
|
||||
const router = useRouter();
|
||||
|
||||
const isProcessing = ref<boolean>(false);
|
||||
|
||||
if (!serverInfo.value.success) {
|
||||
throw new Error("サーバー情報の取得に失敗しました。");
|
||||
}
|
||||
|
||||
if (!serverInfo.value.isInitialized) {
|
||||
router.replace("/setup/initialization");
|
||||
}
|
||||
|
||||
if (!account.value.success) {
|
||||
switch (account.value.error.bad) {
|
||||
case "client":
|
||||
router.replace("/signin");
|
||||
break;
|
||||
default:
|
||||
throw new Error("アカウント情報の取得に失敗しました。");
|
||||
}
|
||||
}
|
||||
|
||||
(async () => {
|
||||
isProcessing.value = true;
|
||||
|
||||
if (!serverInfo.value.success) {
|
||||
throw new Error("サーバー情報の取得に失敗しました。");
|
||||
}
|
||||
|
||||
const communityId = route.params.id;
|
||||
if (typeof communityId !== "string") {
|
||||
isProcessing.value = false;
|
||||
createModal({
|
||||
component: GoHomeError,
|
||||
onClose: async () => await router.push("/"),
|
||||
props: {
|
||||
error: "不正なアクセスです。",
|
||||
},
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
const community = await client.value.request("community/get", {
|
||||
id: communityId,
|
||||
});
|
||||
|
||||
if (!community.success) {
|
||||
isProcessing.value = false;
|
||||
createModal({
|
||||
component: GoHomeError,
|
||||
onClose: async () => await router.push("/"),
|
||||
props: {
|
||||
error: "コミュニティが取得できませんでした。",
|
||||
},
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
document.title = `${community.community.name} | ${serverInfo.value.name}`;
|
||||
title.value = community.community.name;
|
||||
|
||||
isProcessing.value = false;
|
||||
})();
|
||||
</script>
|
||||
Reference in New Issue
Block a user