Add new endpoint for login language

This commit is contained in:
Rene Vergara 2023-05-10 14:58:31 -05:00
parent 4e8ecb24e6
commit 0afcaed076
Signed by: pitmutt
GPG Key ID: 65122AD495A7F5B2
2 changed files with 9 additions and 0 deletions

View File

@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- `isUserValid` function
- New middleware to validated requests come from an existing user
- New endpoint for the language data of the login page
### Changed

View File

@ -1133,6 +1133,14 @@ routes pipe config = do
liftAndCatchIO $ run (deleteOrder oId)
status ok200
-- Get language for component
get "getloginlang" $ do
lang <- param "lang"
txtPack' <- liftAndCatchIO $ run (findLangComponent lang "login")
case cast' . Doc =<< txtPack' of
Nothing -> status noContent204
Just textPack -> do
status ok200
Web.Scotty.json $ toJSON (textPack :: LangComponent)
get "/api/getlang" $ do
component <- param "component"
lang <- param "lang"