mirror of
https://github.com/kmc7468/arkvault.git
synced 2026-02-04 08:06:56 +00:00
사소한 리팩토링 3
This commit is contained in:
@@ -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,
|
||||
});
|
||||
};
|
||||
@@ -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;
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -1,2 +1 @@
|
||||
export * from "./callApi";
|
||||
export * from "./gotoStateful";
|
||||
@@ -1,5 +1,5 @@
|
||||
import { error } from "@sveltejs/kit";
|
||||
import { keyExportState } from "$lib/hooks/gotoStateful";
|
||||
import { keyExportState } from "$lib/utils/gotoStateful";
|
||||
import type { PageLoad } from "./$types";
|
||||
|
||||
export const load: PageLoad = async () => {
|
||||
|
||||
@@ -4,9 +4,9 @@
|
||||
import { BottomDiv, Button, FullscreenDiv, TextButton } from "$lib/components/atoms";
|
||||
import { TitledDiv } from "$lib/components/molecules";
|
||||
import { ForceLoginModal } from "$lib/components/organisms";
|
||||
import { gotoStateful } from "$lib/hooks";
|
||||
import { storeClientKeys } from "$lib/modules/key";
|
||||
import { clientKeyStore } from "$lib/stores";
|
||||
import { gotoStateful } from "$lib/utils";
|
||||
import Order from "./Order.svelte";
|
||||
import {
|
||||
generateClientKeys,
|
||||
|
||||
@@ -3,11 +3,10 @@ import { initTRPC, TRPCError } from "@trpc/server";
|
||||
import superjson from "superjson";
|
||||
import { authorizeMiddleware, authorizeClientMiddleware } from "./middlewares/authorize";
|
||||
|
||||
export const createContext = (event: RequestEvent) => event;
|
||||
export type Context = Awaited<ReturnType<typeof createContext>>;
|
||||
|
||||
export const createContext = (event: RequestEvent) => event;
|
||||
export const t = initTRPC.context<Context>().create({ transformer: superjson });
|
||||
|
||||
export const router = t.router;
|
||||
export const publicProcedure = t.procedure;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user