Add basic services; Base layout
This commit is contained in:
parent
be6467cd2c
commit
ef526cd2db
30 changed files with 291 additions and 34 deletions
26
src/services/auth/auth.ts
Normal file
26
src/services/auth/auth.ts
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
import { fetchLoginApi, fetchRefreshApi } from "../../api/auth";
|
||||
import { AuthActionTypes } from "../../store/auth";
|
||||
import { dispatch } from "../../store/state";
|
||||
|
||||
const fetchLogin = async (username: string, password: string) => {
|
||||
const data = await fetchLoginApi({
|
||||
username: username,
|
||||
password: password,
|
||||
});
|
||||
|
||||
dispatch({
|
||||
type: AuthActionTypes.FETCH_LOGIN_FINISH,
|
||||
payload: data,
|
||||
});
|
||||
};
|
||||
|
||||
const fetchRefresh = async () => {
|
||||
const data = await fetchRefreshApi();
|
||||
|
||||
dispatch({
|
||||
type: AuthActionTypes.FETCH_REFRESH_FINISH,
|
||||
payload: data,
|
||||
});
|
||||
};
|
||||
|
||||
export { fetchLogin, fetchRefresh };
|
||||
1
src/services/auth/index.ts
Normal file
1
src/services/auth/index.ts
Normal file
|
|
@ -0,0 +1 @@
|
|||
export * from "./auth";
|
||||
Loading…
Add table
Add a link
Reference in a new issue