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 - `isUserValid` function
- New middleware to validated requests come from an existing user - New middleware to validated requests come from an existing user
- New endpoint for the language data of the login page
### Changed ### Changed

View file

@ -1133,6 +1133,14 @@ routes pipe config = do
liftAndCatchIO $ run (deleteOrder oId) liftAndCatchIO $ run (deleteOrder oId)
status ok200 status ok200
-- Get language for component -- 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 get "/api/getlang" $ do
component <- param "component" component <- param "component"
lang <- param "lang" lang <- param "lang"