1
0
Fork 0

Add a logout button.

This commit is contained in:
Nicolas Perriault 2017-05-12 22:03:52 +02:00
parent 3c7584306f
commit 92b9e53b8f
No known key found for this signature in database
GPG Key ID: DA5E4C83904F7A2A
4 changed files with 25 additions and 1 deletions

View File

@ -796,4 +796,5 @@ input.form-control[type=file] {
white-space: nowrap; white-space: nowrap;
overflow: hidden; overflow: hidden;
text-overflow: ellipsis; text-overflow: ellipsis;
margin-left: 3px;
} }

View File

@ -83,6 +83,7 @@ type Msg
| FilterNotifications NotificationFilter | FilterNotifications NotificationFilter
| FollowAccount Int | FollowAccount Int
| LoadAccount Int | LoadAccount Int
| LogoutClient Client
| TimelineLoadNext String String | TimelineLoadNext String String
| MastodonEvent MastodonMsg | MastodonEvent MastodonMsg
| NoOp | NoOp

View File

@ -58,6 +58,23 @@ update msg model =
, Command.loadTimelines <| Just client , Command.loadTimelines <| Just client
] ]
LogoutClient client ->
let
newClients =
List.filter (\c -> c.token /= client.token) model.clients
newClient =
List.head newClients
in
{ model
| clients = newClients
, currentView = Update.Timeline.preferred model
}
! [ Command.saveClients newClients
, Command.loadUserAccount newClient
, Command.loadTimelines newClient
]
MastodonEvent msg -> MastodonEvent msg ->
let let
( newModel, commands ) = ( newModel, commands ) =

View File

@ -47,11 +47,16 @@ accountIdentityView currentUser client =
|> replace "/@" "@" |> replace "/@" "@"
|> text |> text
] ]
, button
[ class "btn btn-danger"
, onClick <| LogoutClient client
]
[ text "Logout" ]
, if isCurrentUser then , if isCurrentUser then
text "" text ""
else else
button button
[ class "btn btn-default" [ class "btn btn-primary"
, onClick <| SwitchClient client , onClick <| SwitchClient client
] ]
[ text "Use" ] [ text "Use" ]