11import { RocoRequest } from "./useHttp"
22import NProgress from "nprogress"
3+ import { useStorage } from "@vueuse/core"
34
45import {
56 AngelDetailObject ,
@@ -11,8 +12,14 @@ import {
1112 SkillDetailObject ,
1213 SkillListData ,
1314 SkillListParma ,
15+ Collections ,
1416} from "../share"
1517
18+ const $UserCollections = useStorage < Collections > (
19+ "rocox-user-collections" ,
20+ new Map ( )
21+ )
22+
1623const baseURL = "https://api.rocotime.com/api"
1724const timeout = 5000
1825const headers = {
@@ -79,6 +86,11 @@ export const useApi = () => {
7986 map . set ( pair . id ! , pair . name ! )
8087 } )
8188
89+ $UserCollections . value . set (
90+ "GetFeatures" ,
91+ ( $UserCollections . value . get ( "GetFeatures" ) ?? 0 ) + 1
92+ )
93+
8294 return map
8395 }
8496
@@ -93,6 +105,11 @@ export const useApi = () => {
93105 ) {
94106 const response = await rocoApi . post < AngelListData > ( "/spiritList/" , params )
95107
108+ $UserCollections . value . set (
109+ "GetAngelList" ,
110+ ( $UserCollections . value . get ( "GetAngelList" ) ?? 0 ) + 1
111+ )
112+
96113 return response . data . data
97114 }
98115
@@ -103,6 +120,11 @@ export const useApi = () => {
103120 params
104121 )
105122
123+ $UserCollections . value . set (
124+ "GetAngel" ,
125+ ( $UserCollections . value . get ( "GetAngel" ) ?? 0 ) + 1
126+ )
127+
106128 return response . data . data
107129 }
108130
@@ -115,6 +137,12 @@ export const useApi = () => {
115137 }
116138 ) {
117139 const response = await rocoApi . post < ItemListData > ( "/Itemlist/" , params )
140+
141+ $UserCollections . value . set (
142+ "GetItemList" ,
143+ ( $UserCollections . value . get ( "GetItemList" ) ?? 0 ) + 1
144+ )
145+
118146 return response . data . data
119147 }
120148
@@ -128,6 +156,12 @@ export const useApi = () => {
128156 }
129157 ) {
130158 const response = await rocoApi . post < SkillListData > ( "/Skilllist/" , params )
159+
160+ $UserCollections . value . set (
161+ "GetSkillList" ,
162+ ( $UserCollections . value . get ( "GetSkillList" ) ?? 0 ) + 1
163+ )
164+
131165 return response . data . data
132166 }
133167
@@ -137,6 +171,12 @@ export const useApi = () => {
137171 "/detail/skill/" ,
138172 params
139173 )
174+
175+ $UserCollections . value . set (
176+ "GetSkill" ,
177+ ( $UserCollections . value . get ( "GetSkill" ) ?? 0 ) + 1
178+ )
179+
140180 return response . data
141181 }
142182
0 commit comments