Add getmainlang endpoint

This commit is contained in:
Rene Vergara 2023-05-11 11:59:57 -05:00
parent f68675af03
commit 1c202cf817
Signed by: pitmutt
GPG key ID: 65122AD495A7F5B2

View file

@ -849,7 +849,8 @@ routes pipe config = do
user <- liftAndCatchIO $ run (findUser sess)
case user of
Nothing -> status noContent204
Just u -> status ok200
Just u -> do
status ok200
--Get user associated with session
get "/api/user" $ do
sess <- param "session"
@ -1140,6 +1141,14 @@ routes pipe config = do
liftAndCatchIO $ run (deleteOrder oId)
status ok200
-- Get language for component
get "/getmainlang" $ do
lang <- param "lang"
txtPack' <- liftAndCatchIO $ run (findLangComponent lang "main")
case cast' . Doc =<< txtPack' of
Nothing -> status noContent204
Just textPack -> do
status ok200
Web.Scotty.json $ toJSON (textPack :: LangComponent)
get "/getloginlang" $ do
lang <- param "lang"
txtPack' <- liftAndCatchIO $ run (findLangComponent lang "login")