mirror of
https://github.com/logto-io/logto.git
synced 2024-12-16 20:26:19 -05:00
refactor(ui): align hook style
This commit is contained in:
parent
df19eba175
commit
dbdc632381
4 changed files with 5 additions and 7 deletions
|
@ -26,7 +26,7 @@ const usePasswordAction = <Response>({
|
|||
errorHandlers,
|
||||
setErrorMessage,
|
||||
successHandler,
|
||||
}: UsePasswordApiInit<Response>) => {
|
||||
}: UsePasswordApiInit<Response>): [PasswordAction<void>] => {
|
||||
const asyncAction = useApi(api);
|
||||
const handleError = useErrorHandler();
|
||||
const { getErrorMessage, getErrorMessageFromBody } = usePasswordErrorMessage();
|
||||
|
@ -72,9 +72,7 @@ const usePasswordAction = <Response>({
|
|||
]
|
||||
);
|
||||
|
||||
return {
|
||||
action,
|
||||
};
|
||||
return [action];
|
||||
};
|
||||
|
||||
export default usePasswordAction;
|
||||
|
|
|
@ -35,7 +35,7 @@ const SetPassword = () => {
|
|||
window.location.replace(result.redirectTo);
|
||||
}
|
||||
}, []);
|
||||
const { action } = usePasswordAction({
|
||||
const [action] = usePasswordAction({
|
||||
api: async (password) => addProfile({ password }),
|
||||
setErrorMessage,
|
||||
errorHandlers,
|
||||
|
|
|
@ -37,7 +37,7 @@ const RegisterPassword = () => {
|
|||
}
|
||||
}, []);
|
||||
|
||||
const { action } = usePasswordAction({
|
||||
const [action] = usePasswordAction({
|
||||
api: setUserPassword,
|
||||
setErrorMessage,
|
||||
errorHandlers,
|
||||
|
|
|
@ -42,7 +42,7 @@ const ResetPassword = () => {
|
|||
[navigate, setToast, t]
|
||||
);
|
||||
|
||||
const { action } = usePasswordAction({
|
||||
const [action] = usePasswordAction({
|
||||
api: setUserPassword,
|
||||
setErrorMessage,
|
||||
errorHandlers,
|
||||
|
|
Loading…
Reference in a new issue