사소한 리팩토링 3

This commit is contained in:
static
2025-12-26 15:57:05 +09:00
parent c9d4b10356
commit 3eb7411438
8 changed files with 4 additions and 19 deletions

View File

@@ -1,11 +0,0 @@
export const callGetApi = async (input: RequestInfo, fetchInternal = fetch) => {
return await fetchInternal(input);
};
export const callPostApi = async <T>(input: RequestInfo, payload?: T, fetchInternal = fetch) => {
return await fetchInternal(input, {
method: "POST",
headers: { "Content-Type": "application/json" },
body: payload ? JSON.stringify(payload) : undefined,
});
};

View File

@@ -27,7 +27,6 @@ export const requestCategoryCreation = async (
};
export const requestFileRemovalFromCategory = async (fileId: number, categoryId: number) => {
try {
await trpc().category.removeFile.mutate({ id: categoryId, file: fileId });
return true;

View File

@@ -1,4 +1,3 @@
import { callGetApi } from "$lib/hooks";
import { getAllFileInfos } from "$lib/indexedDB/filesystem";
import { decryptData } from "$lib/modules/crypto";
import {
@@ -58,7 +57,7 @@ export const requestFileThumbnailDownload = async (fileId: number, dataKey?: Cry
}
const { contentIv: thumbnailEncryptedIv } = thumbnailInfo;
const res = await callGetApi(`/api/file/${fileId}/thumbnail/download`);
const res = await fetch(`/api/file/${fileId}/thumbnail/download`);
if (!res.ok) return null;
const thumbnailEncrypted = await res.arrayBuffer();

View File

@@ -1,2 +1 @@
export * from "./callApi";
export * from "./gotoStateful";