mirror of
https://github.com/kmc7468/arkvault.git
synced 2026-02-04 08:06:56 +00:00
사소한 리팩토링 2
This commit is contained in:
@@ -1,10 +1,8 @@
|
||||
import { useTRPC } from "$trpc/client";
|
||||
import { trpc } from "$trpc/client";
|
||||
|
||||
export const requestPasswordChange = async (oldPassword: string, newPassword: string) => {
|
||||
const trpc = useTRPC();
|
||||
|
||||
try {
|
||||
await trpc.auth.changePassword.mutate({ oldPassword, newPassword });
|
||||
await trpc().auth.changePassword.mutate({ oldPassword, newPassword });
|
||||
return true;
|
||||
} catch {
|
||||
// TODO: Error Handling
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { useTRPC } from "$trpc/client";
|
||||
import { trpc } from "$trpc/client";
|
||||
|
||||
export { requestLogout } from "$lib/services/auth";
|
||||
export { requestDeletedFilesCleanup } from "$lib/services/file";
|
||||
@@ -8,10 +8,8 @@ export {
|
||||
} from "$lib/services/key";
|
||||
|
||||
export const requestLogin = async (email: string, password: string) => {
|
||||
const trpc = useTRPC();
|
||||
|
||||
try {
|
||||
await trpc.auth.login.mutate({ email, password });
|
||||
await trpc().auth.login.mutate({ email, password });
|
||||
return true;
|
||||
} catch {
|
||||
// TODO: Error Handling
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { encryptData } from "$lib/modules/crypto";
|
||||
import { storeFileThumbnailCache } from "$lib/modules/file";
|
||||
import { requestFileThumbnailUpload } from "$lib/services/file";
|
||||
import { useTRPC } from "$trpc/client";
|
||||
import { trpc } from "$trpc/client";
|
||||
|
||||
export { requestCategoryCreation, requestFileRemovalFromCategory } from "$lib/services/category";
|
||||
export { requestFileDownload } from "$lib/services/file";
|
||||
@@ -22,10 +22,8 @@ export const requestThumbnailUpload = async (
|
||||
};
|
||||
|
||||
export const requestFileAdditionToCategory = async (fileId: number, categoryId: number) => {
|
||||
const trpc = useTRPC();
|
||||
|
||||
try {
|
||||
await trpc.category.addFile.mutate({ id: categoryId, file: fileId });
|
||||
await trpc().category.addFile.mutate({ id: categoryId, file: fileId });
|
||||
return true;
|
||||
} catch {
|
||||
// TODO: Error Handling
|
||||
|
||||
@@ -1,14 +1,13 @@
|
||||
import { error } from "@sveltejs/kit";
|
||||
import { useTRPC } from "$trpc/client";
|
||||
import { trpc } from "$trpc/client";
|
||||
import type { PageLoad } from "./$types";
|
||||
|
||||
export const load: PageLoad = async ({ fetch }) => {
|
||||
const trpc = useTRPC(fetch);
|
||||
|
||||
try {
|
||||
const files = await trpc.file.listWithoutThumbnail.query();
|
||||
const files = await trpc(fetch).file.listWithoutThumbnail.query();
|
||||
return { files };
|
||||
} catch {
|
||||
// TODO: Error Handling
|
||||
error(500, "Internal server error");
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user