On Monday, 3 April 2017 00:21:14 UTC+12, Simon wrote:
>
> Sounds like you need this function 
> http://package.elm-lang.org/packages/simonh1000/elm-jwt/5.0.0/Jwt#isExpired
>
>>
>>
Cheers. Yep. I've got it working now I think. It wasn't as bad as I 
thought, was reading too much old Elm pages. :)

Here's where I got to. I used a subscription to get the time updating every 
few seconds and and an update function to receive the time check for 
expiry, and then at that point calling this. 

tokenExpired : Model -> Bool
tokenExpired model =
    let
        expiryResult =
            case ( model.theTime, model.authenticationModel ) of
                ( Just time, Auth.LoggedIn user ) ->
                    isExpired time user.token

                _ ->
                    Ok False
    in
        case expiryResult of
            Ok result ->
                False

            Err _ ->
                True

-- 
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.

Reply via email to