mirror of
https://github.com/jxxghp/MoviePilot-Frontend.git
synced 2026-09-06 16:16:42 +08:00
fix message switchs
This commit is contained in:
@@ -1,9 +1,13 @@
|
|||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import api from "@/api";
|
import api from "@/api";
|
||||||
import { NotificationSwitch } from "@/api/types";
|
import { NotificationSwitch } from "@/api/types";
|
||||||
|
import { useToast } from "vue-toast-notification";
|
||||||
|
|
||||||
const messagemTypes = ref<NotificationSwitch[]>([]);
|
const messagemTypes = ref<NotificationSwitch[]>([]);
|
||||||
|
|
||||||
|
// 提示框
|
||||||
|
const $toast = useToast();
|
||||||
|
|
||||||
// 调用API查询消息开关
|
// 调用API查询消息开关
|
||||||
const loadNotificationSwitchs = async () => {
|
const loadNotificationSwitchs = async () => {
|
||||||
try {
|
try {
|
||||||
@@ -14,6 +18,21 @@ const loadNotificationSwitchs = async () => {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// 调用API保存消息开关
|
||||||
|
const saveNotificationSwitchs = async () => {
|
||||||
|
try {
|
||||||
|
const result: { [key: string]: any } = await api.post("message/switchs", messagemTypes.value);
|
||||||
|
if (result.success) {
|
||||||
|
$toast.success("保存通知消息设置成功");
|
||||||
|
} else {
|
||||||
|
$toast.error("保存通知消息设置失败!");
|
||||||
|
}
|
||||||
|
messagemTypes.value = messagemTypes.value;
|
||||||
|
} catch (error) {
|
||||||
|
console.log(error);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
loadNotificationSwitchs();
|
loadNotificationSwitchs();
|
||||||
});
|
});
|
||||||
@@ -55,9 +74,9 @@ onMounted(() => {
|
|||||||
<VDivider />
|
<VDivider />
|
||||||
|
|
||||||
<VCardText>
|
<VCardText>
|
||||||
<VForm @submit.prevent="() => {}">
|
<VForm @submit.prevent="() => { }">
|
||||||
<div class="d-flex flex-wrap gap-4 mt-4">
|
<div class="d-flex flex-wrap gap-4 mt-4">
|
||||||
<VBtn mtype="submit"> 保存 </VBtn>
|
<VBtn mtype="submit" @click="saveNotificationSwitchs"> 保存 </VBtn>
|
||||||
</div>
|
</div>
|
||||||
</VForm>
|
</VForm>
|
||||||
</VCardText>
|
</VCardText>
|
||||||
|
|||||||
Reference in New Issue
Block a user