@@ -4,6 +4,7 @@ import type { uni } from '@delta-comic/model'
44import { Global } from ' @delta-comic/plugin'
55import { createLoadingMessage } from ' @delta-comic/ui'
66import { createReusableTemplate } from ' @vueuse/core'
7+ import type { PopoverAction } from ' vant'
78
89const $props = defineProps <{
910 page: uni .content .ContentPage
@@ -22,22 +23,28 @@ const getIsSubscribe = (author: uni.item.Author) =>
2223 .then (v => v .length != 0 )
2324 )
2425
26+ const { upsert } = SubscribeDB .useUpsert ()
2527const addSubscribe = (author : uni .item .Author ) =>
2628 createLoadingMessage (' 关注中' ).bind (
27- SubscribeDB .upsert ({
28- type: ' author' ,
29- author ,
30- plugin: author .$$plugin ,
31- key: SubscribeDB .key .toString ([author .$$plugin , author .label ]),
32- itemKey: null
29+ upsert ({
30+ items: [
31+ {
32+ type: ' author' ,
33+ author ,
34+ plugin: author .$$plugin ,
35+ key: SubscribeDB .key .toString ([author .$$plugin , author .label ]),
36+ itemKey: null
37+ }
38+ ]
3339 })
3440 )
41+
42+ const { remove } = SubscribeDB .useRemove ()
3543const removeSubscribe = (author : uni .item .Author ) =>
3644 createLoadingMessage (' 取消中' ).bind (
37- db .value
38- .deleteFrom (' subscribe' )
39- .where (' key' , ' =' , SubscribeDB .key .toString ([author .$$plugin , author .label ]))
40- .execute ()
45+ remove ({
46+ keys: [SubscribeDB .key .toString ([author .$$plugin , author .label ])]
47+ })
4148 )
4249
4350const getActionInfo = (key : string ) => Global .userActions .get ([$props .page .plugin , key ])!
0 commit comments