Skip to content

Commit

Permalink
fix(ManageTokens): fixed freeze of the password window
Browse files Browse the repository at this point in the history
  • Loading branch information
vitshev committed Jun 20, 2024
1 parent 65e0b6a commit c2e20ab
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 27 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -45,34 +45,38 @@ const AuthenticationGenerateTokenFormSection: FC<{onClose: () => void}> = ({onCl

setError(undefined);

return getPassword().then((password_sha256) => {
return dispatch(
manageTokensCreateToken({
description,
credentials: {
user,
password_sha256,
},
}),
)
.then((token) => {
setToken(token);

return dispatch(
manageTokensGetList({
return getPassword()
.then((password_sha256) => {
return dispatch(
manageTokensCreateToken({
description,
credentials: {
user,
password_sha256,
}),
)
.then(() => undefined)
.catch(() => undefined);
})
.catch((error) => {
setError(error);
},
}),
)
.then((token) => {
setToken(token);

return Promise.reject(error);
});
});
return dispatch(
manageTokensGetList({
user,
password_sha256,
}),
)
.then(() => undefined)
.catch(() => undefined);
})
.catch((error) => {
setError(error);

return Promise.reject(error);
});
})
.catch((error) => {
throw error;
});
};

if (token) {
Expand Down Expand Up @@ -260,7 +264,7 @@ const AuthenticationTokensSection: FC<{
});
});
},
[getPassword, user, onSuccessRemove],
[getPassword, user, onSuccessRemove, tokens, manageTokensRevokeToken, dispatch],
);

return (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ export function ManageTokensPasswordModalContextProvider({children}: {children:
const handleCancel = () => {
setVisible(false);

p.current.reject();
p.current.reject(new Error('cancel password window'));
};

const handleConfirm = (hash: string) => {
Expand Down

0 comments on commit c2e20ab

Please # to comment.