Web: Refactoring asyn/promise calls

This commit is contained in:
Alexey Safronov 2021-11-03 18:35:15 +03:00 committed by GitHub
parent 5d953407ad
commit baccb134a6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -187,25 +187,25 @@ const Form = (props) => {
const { error, confirmedEmail } = match.params; const { error, confirmedEmail } = match.params;
const oAuthLogin = async (profile) => { const oAuthLogin = async (profile) => {
await thirdPartyLogin(profile) try {
.then(() => { await thirdPartyLogin(profile);
const redirectPath = localStorage.getItem("redirectPath");
if (redirectPath) { const redirectPath = localStorage.getItem("redirectPath");
localStorage.removeItem("redirectPath");
window.location.href = redirectPath; if (redirectPath) {
} localStorage.removeItem("redirectPath");
}) window.location.href = redirectPath;
.catch(() => { }
toastr.error( }
t("Common:ProviderNotConnected"), catch(e) {
t("Common:ProviderLoginError") toastr.error(
); t("Common:ProviderNotConnected"),
}) t("Common:ProviderLoginError")
.finally(() => { );
localStorage.removeItem("profile"); }
localStorage.removeItem("code");
}); localStorage.removeItem("profile");
localStorage.removeItem("code");
}; };
useEffect(() => { useEffect(() => {