From d2937a76d9792c6b8a2ce68023e9e40d65418181 Mon Sep 17 00:00:00 2001 From: Andrey Antukh Date: Fri, 9 Aug 2024 14:16:16 +0200 Subject: [PATCH] :bug: Fix error handling issue on login with oidc happens when no oidc backend is configured on backend --- frontend/src/app/main/ui/auth/login.cljs | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/frontend/src/app/main/ui/auth/login.cljs b/frontend/src/app/main/ui/auth/login.cljs index c43741175..2881458d8 100644 --- a/frontend/src/app/main/ui/auth/login.cljs +++ b/frontend/src/app/main/ui/auth/login.cljs @@ -53,14 +53,15 @@ (.replace js/location redirect-uri) (log/error :hint "unexpected response from OIDC method" :resp (pr-str rsp)))) - (fn [{:keys [type code] :as error}] - (cond - (and (= type :restriction) - (= code :provider-not-configured)) - (st/emit! (ntf/error (tr "errors.auth-provider-not-configured"))) + (fn [cause] + (let [{:keys [type code] :as error} (ex-data cause)] + (cond + (and (= type :restriction) + (= code :provider-not-configured)) + (st/emit! (ntf/error (tr "errors.auth-provider-not-configured"))) - :else - (st/emit! (ntf/error (tr "errors.generic")))))))) + :else + (st/emit! (ntf/error (tr "errors.generic"))))))))) (def ^:private schema:login-form [:map {:title "LoginForm"}