diff --git a/CHANGELOG.md b/CHANGELOG.md index 54f0bf2..f4f81bd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/src/ZGoBackend.hs b/src/ZGoBackend.hs index 156c791..116002a 100644 --- a/src/ZGoBackend.hs +++ b/src/ZGoBackend.hs @@ -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"