Add new endpoint for login language
This commit is contained in:
parent
4e8ecb24e6
commit
0afcaed076
2 changed files with 9 additions and 0 deletions
|
@ -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
|
||||
|
||||
|
|
|
@ -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"
|
||||
|
|
Loading…
Reference in a new issue