0
Fork 0
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:
Gao Sun 2023-09-07 17:35:27 +08:00
parent df19eba175
commit dbdc632381
No known key found for this signature in database
GPG key ID: 13EBE123E4773688
4 changed files with 5 additions and 7 deletions

View file

@ -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;

View file

@ -35,7 +35,7 @@ const SetPassword = () => {
window.location.replace(result.redirectTo);
}
}, []);
const { action } = usePasswordAction({
const [action] = usePasswordAction({
api: async (password) => addProfile({ password }),
setErrorMessage,
errorHandlers,

View file

@ -37,7 +37,7 @@ const RegisterPassword = () => {
}
}, []);
const { action } = usePasswordAction({
const [action] = usePasswordAction({
api: setUserPassword,
setErrorMessage,
errorHandlers,

View file

@ -42,7 +42,7 @@ const ResetPassword = () => {
[navigate, setToast, t]
);
const { action } = usePasswordAction({
const [action] = usePasswordAction({
api: setUserPassword,
setErrorMessage,
errorHandlers,