fix subscribe

This commit is contained in:
jxxghp
2023-07-03 10:42:40 +08:00
parent 9455e46849
commit 569f88617a
2 changed files with 11 additions and 3 deletions

View File

@@ -37,6 +37,8 @@ export interface Subscribe {
note?: string;
// 状态N-新建, R-订阅中
state: string;
// 最后更新时间
last_update: string;
}
// 历史记录

View File

@@ -39,7 +39,13 @@ const addSubscribe = async () => {
doubanid: props.media?.douban_id,
season: props.media?.season,
});
isSubscribed.value = result.success || false;
// 订阅状态
if (result.success) {
// 订阅成功
isSubscribed.value = true;
} else {
// TODO 弹出错误提示
}
} catch (error) {
console.error(error);
}
@@ -72,7 +78,7 @@ const checkSubscribe = async () => {
let mediaid = props.media?.tmdb_id
? `tmdb:${props.media?.tmdb_id}`
: `douban:${props.media?.douban_id}`;
const result: Subscribe = await api.get(`subscribe/${mediaid}`, {
const result: Subscribe = await api.get(`subscribe/media/${mediaid}`, {
params: {
season: props.media?.season,
},
@@ -111,7 +117,7 @@ const openDetailWindow = () => {
};
// 装载时检查是否已订阅
onMounted(checkSubscribe);
onBeforeMount(checkSubscribe);
</script>
<template>