mirror of
https://github.com/muerwre/vault-frontend.git
synced 2025-04-25 12:56:41 +07:00
user check on rehydrate
This commit is contained in:
parent
eda46bdb9d
commit
2377509d52
4 changed files with 3389 additions and 3390 deletions
|
@ -8,6 +8,7 @@ import {
|
|||
import { API } from '~/constants/api';
|
||||
import { IResultWithStatus } from '~/redux/types';
|
||||
import { userLoginTransform } from '~/redux/auth/transforms';
|
||||
import { IUser } from './types';
|
||||
|
||||
export const apiUserLogin = ({
|
||||
username,
|
||||
|
@ -15,8 +16,15 @@ export const apiUserLogin = ({
|
|||
}: {
|
||||
username: string;
|
||||
password: string;
|
||||
}): Promise<IResultWithStatus<{ token: string; status?: number }>> => api
|
||||
.post(API.USER.LOGIN, { username, password })
|
||||
.then(resultMiddleware)
|
||||
.catch(errorMiddleware)
|
||||
.then(userLoginTransform);
|
||||
}): Promise<IResultWithStatus<{ token: string; status?: number }>> =>
|
||||
api
|
||||
.post(API.USER.LOGIN, { username, password })
|
||||
.then(resultMiddleware)
|
||||
.catch(errorMiddleware)
|
||||
.then(userLoginTransform);
|
||||
|
||||
export const apiAuthGetUser = ({ access }): Promise<IResultWithStatus<{ user: IUser }>> =>
|
||||
api
|
||||
.get(API.USER.ME, configWithToken(access))
|
||||
.then(resultMiddleware)
|
||||
.catch(errorMiddleware);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue