
----------------------------------------------------------------------------
data Action
= FetchGitHub
| SetGitHub (Response GitHub)
| ErrorHandler (Response MisoString)
----------------------------------------------------------------------------
app :: App Model Action
app = component emptyModel updateModel viewModel
----------------------------------------------------------------------------
updateModel :: Action -> Transition Model Action
updateModel = \case
FetchGitHub ->
getJSON "https://api.github.com" [] SetGitHub ErrorHandler
SetGitHub Response {..} ->
info ?= body
ErrorHandler Response {..} ->
io_ (consoleError body)
----------------------------------------------------------------------------
Install Nix Flakes, then:
nix develop .#wasm
make
make serve