Update eslint to type check

This commit is contained in:
2025-05-25 13:34:23 -04:00
parent c4265bbcad
commit 8b5efb0879
68 changed files with 2420 additions and 2015 deletions

View File

@@ -1,28 +1,13 @@
import { Account } from "@/interface/Account";
import { api } from "@/util/AxiosUtil";
import api from "@/util/AxiosUtil";
import { useMutation } from "@tanstack/react-query";
import { AxiosError } from "axios";
export function useSignup(){
return useMutation({
mutationKey: ["signup"],
mutationFn: async (account: Account) => {
try{
const response = await api.post("/auth/signup", account);
if(response.data.errors){
throw new Error(response.data.errors.join(", "));
}
}
catch(error){
if(error instanceof AxiosError && error.response?.data.errors){
throw new Error(error.response?.data.errors.join(", "));
}
else{
throw error;
}
}
await api.post("/auth/signup", account);
}
});
}
@@ -32,21 +17,7 @@ export function useConfirm(){
return useMutation({
mutationKey: ["confirm"],
mutationFn: async (confirmToken: string) => {
try{
const response = await api.post(`/auth/confirm/${confirmToken}`);
if(response.data.errors){
throw new Error(response.data.errors.join(", "));
}
}
catch(error){
if(error instanceof AxiosError && error.response?.data.errors){
throw new Error(error.response?.data.errors.join(", "));
}
else{
throw error;
}
}
await api.post(`/auth/confirm/${confirmToken}`);
}
});
}
@@ -59,21 +30,7 @@ export function useForgotPassword(){
params.append("username", username);
try{
const response = await api.post(`/auth/forgot?${params}`);
if(response.data.errors){
throw new Error(response.data.errors.join(", "));
}
}
catch(error){
if(error instanceof AxiosError && error.response?.data.errors){
throw new Error(error.response?.data.errors.join(", "));
}
else{
throw error;
}
}
await api.post(`/auth/forgot?${params}`);
}
});
}
@@ -82,21 +39,7 @@ export function useForgotResetPassword(forgotToken: string){
return useMutation({
mutationKey: ["forgotResetPassword"],
mutationFn: async (password: string) => {
try{
const response = await api.post(`/auth/forgot/${forgotToken}`, {password});
if(response.data.errors){
throw new Error(response.data.errors.join(", "));
}
}
catch(error){
if(error instanceof AxiosError && error.response?.data.errors){
throw new Error(error.response?.data.errors.join(", "));
}
else{
throw error;
}
}
await api.post(`/auth/forgot/${forgotToken}`, {password});
}
});
}