This commit is contained in:
Philipinho
2024-06-22 22:13:22 +01:00
parent 81be99b404
commit 562abb0413
14 changed files with 54 additions and 146 deletions

View File

@ -1,9 +1,5 @@
import { useState } from "react";
import {
login,
register,
setupWorkspace,
} from "@/features/auth/services/auth-service";
import { login, setupWorkspace } from "@/features/auth/services/auth-service";
import { useNavigate } from "react-router-dom";
import { useAtom } from "jotai";
import { authTokensAtom } from "@/features/auth/atoms/auth-tokens-atom";
@ -46,25 +42,6 @@ export default function useAuth() {
}
};
const handleSignUp = async (data: IRegister) => {
setIsLoading(true);
try {
const res = await register(data);
setIsLoading(false);
setAuthToken(res.tokens);
navigate(APP_ROUTE.HOME);
} catch (err) {
setIsLoading(false);
notifications.show({
message: err.response?.data.message,
color: "red",
});
}
};
const handleInvitationSignUp = async (data: IAcceptInvite) => {
setIsLoading(true);
@ -135,7 +112,6 @@ export default function useAuth() {
return {
signIn: handleSignIn,
signUp: handleSignUp,
invitationSignup: handleInvitationSignUp,
setupWorkspace: handleSetupWorkspace,
isAuthenticated: handleIsAuthenticated,