diff --git a/apps/backoffice/src/app/page.tsx b/apps/backoffice/src/app/page.tsx index 7ba7fee..dc8a0c8 100644 --- a/apps/backoffice/src/app/page.tsx +++ b/apps/backoffice/src/app/page.tsx @@ -16,6 +16,10 @@ export const Components: FC = (): ReactElement => { console.log(payload); // for debugging const response = await postLogin(payload); + const { access_token, refresh_token } = response.data.token; + sessionStorage.setItem('access_token', access_token); + localStorage.setItem('refresh_token', refresh_token); + console.log('Login successful:', response); // for debugging navigate('/dashboard'); } catch (error) { @@ -39,6 +43,7 @@ export const Components: FC = (): ReactElement => { className="w-full" value={email} onChange={(e) => setEmail(e.target.value)} + autoFocus /> ({ root: __dirname, cacheDir: '../../node_modules/.vite/apps/backoffice', server: { - port: 4200, + port: 3000, host: 'localhost', }, preview: { - port: 4300, + port: 3001, host: 'localhost', }, plugins: [react(), nxViteTsPaths(), nxCopyAssetsPlugin(['*.md'])], diff --git a/libs/service/src/types/auth/index.ts b/libs/service/src/types/auth/index.ts index bf094ec..03fc5a7 100644 --- a/libs/service/src/types/auth/index.ts +++ b/libs/service/src/types/auth/index.ts @@ -10,9 +10,27 @@ export type TLoginResponse = { refresh_token: string; }; user: { + role: { + id: string; + name: string; + permission: [ + { + id: string; + name: string; + created_at: string; + updated_at: string; + } + ] + created_at: string; + updated_at: string; + }; fullname: string; email: string; + avatar: string; + phone_number: string; is_active: boolean; + gender: string; + birthdate: string; }; }; }; diff --git a/libs/ui/src/atoms/input/input.tsx b/libs/ui/src/atoms/input/input.tsx index ae0e849..e780059 100644 --- a/libs/ui/src/atoms/input/input.tsx +++ b/libs/ui/src/atoms/input/input.tsx @@ -40,7 +40,8 @@ export const Input: FC = ({ }): ReactElement => { const [showPassword, setShowPassword] = useState(false); // State for password visibility - const togglePasswordVisibility = () => { + const togglePasswordVisibility = (e: React.FormEvent) => { + e.preventDefault(); if (!disabled) setShowPassword((prev) => !prev); }; @@ -63,6 +64,7 @@ export const Input: FC = ({ {type === 'password' && (