Scylla/src/Scylla/Model.elm

28 lines
985 B
Elm
Raw Normal View History

2018-12-08 13:49:30 -08:00
module Scylla.Model exposing (..)
import Scylla.Api exposing (..)
import Scylla.Sync exposing (SyncResponse)
2018-12-08 15:06:14 -08:00
import Scylla.Login exposing (LoginResponse, Username, Password)
2018-12-08 13:49:30 -08:00
import Browser.Navigation as Nav
import Browser
import Http
import Url exposing (Url)
type alias Model =
{ key : Nav.Key
, token : Maybe ApiToken
2018-12-08 15:06:14 -08:00
, loginUsername : Username
, loginPassword : Password
2018-12-08 13:49:30 -08:00
, apiUrl : ApiUrl
}
type Msg =
2018-12-08 15:06:14 -08:00
ChangeApiUrl ApiUrl -- During login screen: the API URL (homeserver)
| ChangeLoginUsername Username -- During login screen: the username
| ChangeLoginPassword Password -- During login screen: the password
| AttemptLogin -- During login screen, login button presed
| TryUrl Browser.UrlRequest -- User attempts to change URL
| ChangeUrl Url -- URL changes
| ReceiveSyncResponse (Result Http.Error SyncResponse) -- HTTP, Sync has finished
| ReceiveLoginResponse (Result Http.Error LoginResponse) -- HTTP, Login has finished
2018-12-08 13:49:30 -08:00