summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/Auth.js6
-rw-r--r--src/Auth.purs4
-rw-r--r--src/Main.purs4
3 files changed, 10 insertions, 4 deletions
diff --git a/src/Auth.js b/src/Auth.js
index 9d5060c..246052c 100644
--- a/src/Auth.js
+++ b/src/Auth.js
@@ -49,6 +49,8 @@ export const _clearSessionCookie = () => {
document.cookie = "authelia_session=; expires=Thu, 01 Jan 1970 00:00:00 GMT; SameSite=None; Secure";
};
-export const getRedirect = (x) => {
- return x.redirect;
+export const _getRedirect = (Just) => (Nothing) => (x) => () => {
+ const r = x["data"]["redirect"];
+ if (r) return Just(r);
+ return Nothing;
};
diff --git a/src/Auth.purs b/src/Auth.purs
index a98b575..1b5cd16 100644
--- a/src/Auth.purs
+++ b/src/Auth.purs
@@ -33,4 +33,6 @@ foreign import _clearSessionCookie :: Effect Unit
clearSessionCookie :: forall m. MonadEffect m => m Unit
clearSessionCookie = liftEffect _clearSessionCookie
-foreign import getRedirect :: Foreign -> String
+foreign import _getRedirect :: forall a. (a -> Maybe a) -> Maybe a -> Foreign -> Effect (Maybe String)
+getRedirect :: forall m . MonadEffect m => Foreign -> m (Maybe String)
+getRedirect x = liftEffect $ _getRedirect Just Nothing x
diff --git a/src/Main.purs b/src/Main.purs
index 4d0ec0d..af89f35 100644
--- a/src/Main.purs
+++ b/src/Main.purs
@@ -247,7 +247,9 @@ mainAuth = launchAff_ do
, body: UI.toJSON { username, password }
}
res <- resp
- liftEffect $ log $ getRedirect res
+ getRedirect res >>= case _ of
+ Nothing -> liftEffect $ log "failed"
+ Just r -> liftEffect $ log $ "redirect: " <> r
main :: Effect Unit
main = case Config.mode of