feat: enlarge the size of the next button for uploading files and add locale config to global.ts (#195)
feat: enlarge the size of the next button for uploading files feat: add locale config to global.ts
This commit is contained in:
44
web/src/hooks/loginHooks.ts
Normal file
44
web/src/hooks/loginHooks.ts
Normal file
@@ -0,0 +1,44 @@
|
||||
import { useCallback } from 'react';
|
||||
import { useDispatch } from 'umi';
|
||||
|
||||
export interface ILoginRequestBody {
|
||||
email: string;
|
||||
password: string;
|
||||
}
|
||||
|
||||
export interface IRegisterRequestBody extends ILoginRequestBody {
|
||||
nickname: string;
|
||||
}
|
||||
|
||||
export const useLogin = () => {
|
||||
const dispatch = useDispatch();
|
||||
|
||||
const login = useCallback(
|
||||
(requestBody: ILoginRequestBody) => {
|
||||
// TODO: Type needs to be improved
|
||||
return dispatch<any>({
|
||||
type: 'loginModel/login',
|
||||
payload: requestBody,
|
||||
});
|
||||
},
|
||||
[dispatch],
|
||||
);
|
||||
|
||||
return login;
|
||||
};
|
||||
|
||||
export const useRegister = () => {
|
||||
const dispatch = useDispatch();
|
||||
|
||||
const register = useCallback(
|
||||
(requestBody: IRegisterRequestBody) => {
|
||||
return dispatch<any>({
|
||||
type: 'loginModel/register',
|
||||
payload: requestBody,
|
||||
});
|
||||
},
|
||||
[dispatch],
|
||||
);
|
||||
|
||||
return register;
|
||||
};
|
||||
Reference in New Issue
Block a user