mirror of
https://github.com/kmc7468/arkvault.git
synced 2026-02-04 16:16:55 +00:00
/api/auth 아래의 Endpoint들을 tRPC로 마이그레이션
This commit is contained in:
@@ -1,10 +1,13 @@
|
||||
import { callPostApi } from "$lib/hooks";
|
||||
import type { PasswordChangeRequest } from "$lib/server/schemas";
|
||||
import { useTRPC } from "$trpc/client";
|
||||
|
||||
export const requestPasswordChange = async (oldPassword: string, newPassword: string) => {
|
||||
const res = await callPostApi<PasswordChangeRequest>("/api/auth/changePassword", {
|
||||
oldPassword,
|
||||
newPassword,
|
||||
});
|
||||
return res.ok;
|
||||
const trpc = useTRPC();
|
||||
|
||||
try {
|
||||
await trpc.auth.changePassword.mutate({ oldPassword, newPassword });
|
||||
return true;
|
||||
} catch {
|
||||
// TODO: Error Handling
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user