diff --git a/packages/client/src/pages/PortalSettings/categories/developer-tools/OAuth/sub-components/ClientForm/index.tsx b/packages/client/src/pages/PortalSettings/categories/developer-tools/OAuth/sub-components/ClientForm/index.tsx index c67b0d0578..f22dded6a2 100644 --- a/packages/client/src/pages/PortalSettings/categories/developer-tools/OAuth/sub-components/ClientForm/index.tsx +++ b/packages/client/src/pages/PortalSettings/categories/developer-tools/OAuth/sub-components/ClientForm/index.tsx @@ -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(() => { diff --git a/packages/client/src/store/OAuthStore.ts b/packages/client/src/store/OAuthStore.ts index c4ff0591af..27ba373e51 100644 --- a/packages/client/src/store/OAuthStore.ts +++ b/packages/client/src/store/OAuthStore.ts @@ -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);