Add basic services; Base layout

This commit is contained in:
Aslan 2026-01-01 17:21:56 +01:00
parent be6467cd2c
commit ef526cd2db
30 changed files with 291 additions and 34 deletions

28
src/store/auth/auth.ts Normal file
View file

@ -0,0 +1,28 @@
import { fetchLogin, fetchRefresh } from "../../services/auth";
import { AuthActionTypes, AuthAction } from "./actions";
import { IAuthState } from "./types";
function authReducer(state: IAuthState, action: AuthAction): IAuthState {
switch (action.type) {
case AuthActionTypes.FETCH_LOGIN_START:
fetchLogin(action.payload.username, action.payload.password);
return state;
case AuthActionTypes.FETCH_LOGIN_FINISH:
return {
...state,
session: action.payload,
};
case AuthActionTypes.FETCH_REFRESH_START:
fetchRefresh();
return state;
case AuthActionTypes.FETCH_REFRESH_FINISH:
return {
...state,
session: action.payload,
};
default:
return state;
}
}
export { authReducer };