tooty/src/Init.elm
Nicolas Perriault 7a053b9fa0 Fix #152: Multiple accounts. (#153)
* Update model to store multiple clients.

* Delete tmp registration data after client creation.

* Add minimal account selector view

* Update clients so they can have an account attached.

* List clients in the account selector.

* List accounts in the account selector view.

* It works™.

* Minor CSS fix.

* Reset server value when switching account.

* Fix empty black screen on reauth with new client format.

* Fix typo.

[skip-ci]
2017-05-09 18:43:12 +02:00

36 lines
1.2 KiB
Elm

module Init exposing (init)
import Command
import Navigation
import Types exposing (..)
import Update.Draft
import Update.Timeline
import Util
init : Flags -> Navigation.Location -> ( Model, Cmd Msg )
init { registration, clients } location =
{ server = ""
, currentTime = 0
, registration = registration
, clients = clients
, homeTimeline = Update.Timeline.empty "home-timeline"
, localTimeline = Update.Timeline.empty "local-timeline"
, globalTimeline = Update.Timeline.empty "global-timeline"
, accountTimeline = Update.Timeline.empty "account-timeline"
, accountFollowers = Update.Timeline.empty "account-followers"
, accountFollowing = Update.Timeline.empty "account-following"
, accountRelationships = []
, accountRelationship = Nothing
, notifications = Update.Timeline.empty "notifications"
, draft = Update.Draft.empty
, errors = []
, location = location
, useGlobalTimeline = False
, viewer = Nothing
, currentView = LocalTimelineView
, currentUser = Nothing
, notificationFilter = NotificationAll
}
! [ Command.initCommands registration (List.head clients) (Util.extractAuthCode location) ]