mirror of
https://github.com/Drop-OSS/drop.git
synced 2026-01-31 15:37:09 +01:00
feat: refactor news and migrate rest of useFetch to $dropFetch
This commit is contained in:
@@ -9,10 +9,7 @@ export const useCollections = async () => {
|
||||
// @ts-expect-error
|
||||
const state = useState<FullCollection[]>("collections", () => undefined);
|
||||
if (state.value === undefined) {
|
||||
const headers = useRequestHeaders(["cookie"]);
|
||||
state.value = await $dropFetch<FullCollection[]>("/api/v1/collection", {
|
||||
headers,
|
||||
});
|
||||
state.value = await $dropFetch<FullCollection[]>("/api/v1/collection");
|
||||
}
|
||||
|
||||
return state;
|
||||
@@ -41,8 +38,5 @@ export const useLibrary = async () => {
|
||||
|
||||
export async function refreshLibrary() {
|
||||
const state = useState<FullCollection>("library");
|
||||
const headers = useRequestHeaders(["cookie"]);
|
||||
state.value = await $dropFetch<FullCollection>("/api/v1/collection/default", {
|
||||
headers,
|
||||
});
|
||||
state.value = await $dropFetch<FullCollection>("/api/v1/collection/default");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user