On Friday, September 16, 2016 at 4:00:39 PM UTC+1, Rupert Smith wrote:
>
>
> I just need to think about how to add functions to query the auth state on
> this module too, as it would also be nice to be able to query that all over
> the place too. Something like
>
So to solve this problem I came up with a record type for the current state:
type alias AuthState =
{ loggedIn : Bool
, permissions : List String
}
Which is part of the Auth model which is kept in the top-level state. Then
I just parameterize any views that need to use it:
view : Auth.Types.AuthState -> Model -> Html Msg
and instantiate them accrodingly. Its really only the view where I need to
know the current logged in state, and what permissions a user may have, in
order to decide what to show.
That should wrap things up for now. I'll put the code for this one up on
github soon. I don't know if this is TEA or not, but it seems to work and
feels fairly workable and gives me what I need.
--
You received this message because you are subscribed to the Google Groups "Elm
Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.