🗑️ Remove the personal page

This commit is contained in:
2024-06-26 11:11:23 +08:00
parent 3f64747839
commit 0d02eca76e
9 changed files with 33 additions and 213 deletions

View File

@ -6,7 +6,6 @@
<v-list density="comfortable">
<v-list-item title="Dashboard" prepend-icon="mdi-view-dashboard" :to="{ name: 'dashboard' }" exact />
<v-list-item title="Personalize" prepend-icon="mdi-card-bulleted-outline" :to="{ name: 'personalize' }" />
<v-list-item title="Personal Page" prepend-icon="mdi-sitemap" :to="{ name: 'personal-page' }" />
<v-list-item title="Security" prepend-icon="mdi-security" :to="{ name: 'security' }" />
</v-list>
</v-card>

View File

@ -30,12 +30,6 @@ const router = createRouter({
component: () => import("@/views/personalize.vue"),
meta: { title: "Your personality" },
},
{
path: "/me/personal-page",
name: "personal-page",
component: () => import("@/views/personal-page.vue"),
meta: { title: "Your personal page" },
},
{
path: "/me/security",
name: "security",

View File

@ -1,71 +0,0 @@
<template>
<div>
<v-card class="mb-3" title="Design" prepend-icon="mdi-pencil-ruler" :loading="loading">
<template #text>
<v-form class="mt-1" @submit.prevent="submit">
<v-row dense>
<v-col :cols="12">
<v-textarea hide-details label="Content" density="comfortable" variant="outlined"
v-model="data.content" />
</v-col>
</v-row>
<v-btn type="submit" class="mt-2" variant="text" prepend-icon="mdi-content-save" :disabled="loading">
Apply Changes
</v-btn>
</v-form>
</template>
</v-card>
<v-snackbar v-model="done" :timeout="3000"> Your personal page has been updated.</v-snackbar>
<!-- @vue-ignore -->
<v-snackbar v-model="error" :timeout="5000">Something went wrong... {{ error }}</v-snackbar>
</div>
</template>
<script setup lang="ts">
import { ref } from "vue";
import { getAtk } from "@/stores/userinfo";
import { request } from "@/scripts/request";
const error = ref<string | null>(null);
const done = ref(false);
const loading = ref(false);
const data = ref<any>({});
async function read() {
loading.value = true;
const res = await request("/api/users/me/page", {
headers: { Authorization: `Bearer ${(getAtk())}` }
});
if (res.status !== 200) {
error.value = await res.text();
} else {
data.value = await res.json();
}
loading.value = false;
}
async function submit() {
const payload = data.value;
loading.value = true;
const res = await request("/api/users/me/page", {
method: "PUT",
headers: { "Content-Type": "application/json", Authorization: `Bearer ${getAtk()}` },
body: JSON.stringify(payload)
});
if (res.status !== 200) {
error.value = await res.text();
} else {
await read();
done.value = true;
error.value = null;
}
loading.value = false;
}
read();
</script>