Signup page (mostly) working

This commit is contained in:
2025-03-15 20:20:14 -04:00
parent 0eeedf1e3b
commit 49243a71a1
4 changed files with 127 additions and 14 deletions

20
src/hooks/AuthHooks.ts Normal file
View File

@@ -0,0 +1,20 @@
import { Account } from "@/interface/Account";
import { api } from "@/util/AxiosUtil";
import { useMutation } from "@tanstack/react-query";
export function useSignup(){
return useMutation({
mutationKey: ["signup"],
mutationFn: async (account: Account) => {
const response = await api.post("/auth/signup", account);
if(response.status !== 200){
throw new Error("Failed to signup");
}
else if(response.data.errors){
throw new Error(response.data.errors.join(", "));
}
}
});
}