all repos

onasty @ 33a27b8fc7fbe906fbdf7a446a8104fa705eb43f

a one-time notes service

onasty/web/src/Auth.elm (view raw)

Olexandr Smirnov Olexandr Smirnov
ss2316544@gmail.com
web: button component; improve code consistency (#168)..., 10 months ago
1
module Auth exposing (User, onPageLoad, viewCustomPage)
2
3
import Auth.Action
4
import Auth.User
5
import Dict
6
import Route exposing (Route)
7
import Route.Path
8
import Shared
9
import View exposing (View)
10
11
12
type alias User =
13
    Auth.User.User
14
15
16
onPageLoad : Shared.Model -> Route () -> Auth.Action.Action User
17
onPageLoad shared _ =
18
    case shared.user of
19
        Auth.User.NotSignedIn ->
20
            Auth.Action.pushRoute
21
                { path = Route.Path.Auth
22
                , query = Dict.empty
23
                , hash = Nothing
24
                }
25
26
        Auth.User.RefreshingTokens ->
27
            Auth.Action.loadCustomPage
28
29
        Auth.User.SignedIn credentials ->
30
            Auth.Action.loadPageWithUser credentials
31
32
33
viewCustomPage : Shared.Model -> Route () -> View Never
34
viewCustomPage _ _ =
35
    View.fromString "Loading..."