feat: gacha auth integration (#32)

* feat(gacha): register and login integration

* fix: navbar and gacha landing page

- display fullname when user authenticated
- fix styling and responsive

* fix: minor fix UI
This commit is contained in:
Hafid Nur
2025-05-27 01:41:13 +07:00
committed by GitHub
parent aaf5b4262d
commit 9f25941a4a
13 changed files with 415 additions and 330 deletions
+1 -1
View File
@@ -25,7 +25,7 @@ export const useAuthStore = create<SessionState>((set) => {
return {
isLoading: false,
session: isAuthenticated ? { ...session, ...user } : undefined,
session: isAuthenticated ? { token: session.token, user } : undefined,
status: isAuthenticated
? ESessionStatus.Authenticated
: ESessionStatus.Unauthenticated,
+5 -1
View File
@@ -6,7 +6,10 @@ import { useNavigate } from 'react-router';
export const useSession = () => {
const navigate = useNavigate();
const { mutate, isPending } = usePostLogin();
const { setLoading, setSession, clearSession, session } = useAuthStore();
const { setLoading, setSession, clearSession, session, status } =
useAuthStore();
const isAuthenticated = status === 'authenticated';
const signIn = (payload: TLoginRequest) => {
setLoading(true);
mutate(payload, {
@@ -33,5 +36,6 @@ export const useSession = () => {
signIn,
signOut,
isLoading: isPending,
isAuthenticated,
};
};