fix: add i18n entries for oauth errors

This commit is contained in:
Andrew Bastin
2023-11-14 17:44:37 +05:30
parent 8d7509cdea
commit e93a37c711
3 changed files with 64 additions and 3 deletions

View File

@@ -78,6 +78,15 @@ const clientSecret = pluckRef(auth, "clientSecret" as any)
const scope = pluckRef(auth, "scope")
function translateTokenRequestError(error: string) {
switch (error) {
case "OIDC_DISCOVERY_FAILED":
return t("authorization.oauth.token_generation_oidc_discovery_failed")
default:
return t("authorization.oauth.something_went_wrong_on_token_generation")
}
}
const handleAccessTokenRequest = async () => {
if (
oidcDiscoveryURL.value === "" &&
@@ -102,7 +111,7 @@ const handleAccessTokenRequest = async () => {
const res = await tokenRequest(tokenReqParams)
if (res && E.isLeft(res)) {
toast.error(res.left)
toast.error(translateTokenRequestError(res.left))
}
} catch (e) {
toast.error(`${e}`)