Client:OAuth2: add toastr for catch section
This commit is contained in:
parent
ec66aae56a
commit
8b27e2f47a
@ -149,42 +149,50 @@ const ClientForm = ({
|
||||
|
||||
if (scopeList?.length === 0) actions.push(fetchScopes());
|
||||
|
||||
const [fetchedClient, ...rest] = await Promise.all(actions);
|
||||
try {
|
||||
const [fetchedClient, ...rest] = await Promise.all(actions);
|
||||
|
||||
if (id) {
|
||||
setForm({
|
||||
name: fetchedClient?.name || client?.name || "",
|
||||
logo: fetchedClient?.logo || client?.logo || "",
|
||||
website_url: fetchedClient?.websiteUrl || client?.websiteUrl || "",
|
||||
description: fetchedClient?.description || client?.description || "",
|
||||
if (id) {
|
||||
setForm({
|
||||
name: fetchedClient?.name || client?.name || "",
|
||||
logo: fetchedClient?.logo || client?.logo || "",
|
||||
website_url: fetchedClient?.websiteUrl || client?.websiteUrl || "",
|
||||
description: fetchedClient?.description || client?.description || "",
|
||||
|
||||
redirect_uris:
|
||||
fetchedClient?.redirectUris || client?.redirectUris || [],
|
||||
allowed_origins:
|
||||
fetchedClient?.allowedOrigins || client?.allowedOrigins || [],
|
||||
logout_redirect_uri:
|
||||
fetchedClient?.logoutRedirectUri || client?.logoutRedirectUri || "",
|
||||
redirect_uris:
|
||||
fetchedClient?.redirectUris || client?.redirectUris || [],
|
||||
allowed_origins:
|
||||
fetchedClient?.allowedOrigins || client?.allowedOrigins || [],
|
||||
logout_redirect_uri:
|
||||
fetchedClient?.logoutRedirectUri || client?.logoutRedirectUri || "",
|
||||
|
||||
terms_url: fetchedClient?.termsUrl || client?.termsUrl || "",
|
||||
policy_url: fetchedClient?.policyUrl || client?.policyUrl || "",
|
||||
terms_url: fetchedClient?.termsUrl || client?.termsUrl || "",
|
||||
policy_url: fetchedClient?.policyUrl || client?.policyUrl || "",
|
||||
|
||||
authentication_method:
|
||||
fetchedClient?.authenticationMethod ||
|
||||
client?.authenticationMethod ||
|
||||
AuthenticationMethod.client_secret_post,
|
||||
authentication_method:
|
||||
fetchedClient?.authenticationMethod ||
|
||||
client?.authenticationMethod ||
|
||||
AuthenticationMethod.client_secret_post,
|
||||
|
||||
scopes: fetchedClient?.scopes || client?.scopes || [],
|
||||
});
|
||||
scopes: fetchedClient?.scopes || client?.scopes || [],
|
||||
});
|
||||
|
||||
setClientId(fetchedClient?.clientId || client?.clientId || "");
|
||||
setClientSecret(
|
||||
fetchedClient?.clientSecret || client?.clientSecret || ""
|
||||
);
|
||||
setClientId(fetchedClient?.clientId || client?.clientId || "");
|
||||
setClientSecret(
|
||||
fetchedClient?.clientSecret || client?.clientSecret || ""
|
||||
);
|
||||
|
||||
setInitialClient(client || fetchedClient || ({} as IClientProps));
|
||||
setInitialClient(client || fetchedClient || ({} as IClientProps));
|
||||
}
|
||||
|
||||
setIsLoading(false);
|
||||
} catch (e) {
|
||||
setIsLoading(false);
|
||||
|
||||
console.log("11");
|
||||
|
||||
console.log(e);
|
||||
}
|
||||
|
||||
setIsLoading(false);
|
||||
}, [id, fetchScopes]);
|
||||
|
||||
React.useEffect(() => {
|
||||
|
@ -22,6 +22,9 @@ import {
|
||||
IScope,
|
||||
} from "@docspace/common/utils/oauth/interfaces";
|
||||
|
||||
//@ts-ignore
|
||||
import toastr from "@docspace/components/toast/toastr";
|
||||
|
||||
import SettingsIcon from "PUBLIC_DIR/images/catalog.settings.react.svg?url";
|
||||
import DeleteIcon from "PUBLIC_DIR/images/delete.react.svg?url";
|
||||
import EnableReactSvgUrl from "PUBLIC_DIR/images/enable.react.svg?url";
|
||||
@ -223,6 +226,7 @@ class OAuthStore implements OAuthStoreProps {
|
||||
|
||||
return client;
|
||||
} catch (e) {
|
||||
toastr.error(e);
|
||||
console.log(e);
|
||||
}
|
||||
};
|
||||
@ -245,6 +249,7 @@ class OAuthStore implements OAuthStoreProps {
|
||||
});
|
||||
this.setClientsIsLoading(false);
|
||||
} catch (e) {
|
||||
toastr.error(e);
|
||||
console.log(e);
|
||||
}
|
||||
};
|
||||
@ -257,6 +262,7 @@ class OAuthStore implements OAuthStoreProps {
|
||||
this.consents = [...consentList];
|
||||
});
|
||||
} catch (e) {
|
||||
toastr.error(e);
|
||||
console.log(e);
|
||||
}
|
||||
};
|
||||
@ -302,6 +308,7 @@ class OAuthStore implements OAuthStoreProps {
|
||||
];
|
||||
});
|
||||
} catch (e) {
|
||||
toastr.error(e);
|
||||
console.log(e);
|
||||
}
|
||||
};
|
||||
@ -322,6 +329,7 @@ class OAuthStore implements OAuthStoreProps {
|
||||
});
|
||||
}
|
||||
} catch (e) {
|
||||
toastr.error(e);
|
||||
console.log(e);
|
||||
}
|
||||
};
|
||||
@ -338,6 +346,7 @@ class OAuthStore implements OAuthStoreProps {
|
||||
});
|
||||
}
|
||||
} catch (e) {
|
||||
toastr.error(e);
|
||||
console.log(e);
|
||||
}
|
||||
};
|
||||
@ -348,6 +357,7 @@ class OAuthStore implements OAuthStoreProps {
|
||||
|
||||
return client_secret;
|
||||
} catch (e) {
|
||||
toastr.error(e);
|
||||
console.log(e);
|
||||
}
|
||||
};
|
||||
@ -371,6 +381,7 @@ class OAuthStore implements OAuthStoreProps {
|
||||
|
||||
this.setActiveClient("");
|
||||
} catch (e) {
|
||||
toastr.error(e);
|
||||
console.log(e);
|
||||
}
|
||||
};
|
||||
@ -381,6 +392,7 @@ class OAuthStore implements OAuthStoreProps {
|
||||
|
||||
return scope;
|
||||
} catch (e) {
|
||||
toastr.error(e);
|
||||
console.log(e);
|
||||
|
||||
return {} as IScope;
|
||||
@ -393,6 +405,7 @@ class OAuthStore implements OAuthStoreProps {
|
||||
|
||||
this.scopes = scopes;
|
||||
} catch (e) {
|
||||
toastr.error(e);
|
||||
console.log(e);
|
||||
}
|
||||
};
|
||||
@ -416,6 +429,7 @@ class OAuthStore implements OAuthStoreProps {
|
||||
|
||||
this.setActiveClient("");
|
||||
} catch (e) {
|
||||
toastr.error(e);
|
||||
console.log(e);
|
||||
}
|
||||
};
|
||||
@ -522,7 +536,9 @@ class OAuthStore implements OAuthStoreProps {
|
||||
|
||||
this.setActiveClient("");
|
||||
this.setSelection("");
|
||||
} catch (e) {}
|
||||
} catch (e) {
|
||||
toastr.error(e);
|
||||
}
|
||||
} else {
|
||||
this.setActiveClient(clientId);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user