feat(backoffice): implement login and logout

- Tambah fitur login dan logout pada Backoffice
- Ubah port development server dan atasi CORS
- Update type login response
- Update component Input agar toggle password berfungsi dengan benar
This commit is contained in:
Hafid Nur
2025-04-03 06:10:07 +07:00
parent 2602657201
commit a9cc728ade
5 changed files with 36 additions and 6 deletions
+5
View File
@@ -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
/>
<InputForm
label="Password"