Add a logout button.
This commit is contained in:
parent
3c7584306f
commit
92b9e53b8f
@ -796,4 +796,5 @@ input.form-control[type=file] {
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
margin-left: 3px;
|
||||
}
|
||||
|
@ -83,6 +83,7 @@ type Msg
|
||||
| FilterNotifications NotificationFilter
|
||||
| FollowAccount Int
|
||||
| LoadAccount Int
|
||||
| LogoutClient Client
|
||||
| TimelineLoadNext String String
|
||||
| MastodonEvent MastodonMsg
|
||||
| NoOp
|
||||
|
@ -58,6 +58,23 @@ update msg model =
|
||||
, 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 ->
|
||||
let
|
||||
( newModel, commands ) =
|
||||
|
@ -47,11 +47,16 @@ accountIdentityView currentUser client =
|
||||
|> replace "/@" "@"
|
||||
|> text
|
||||
]
|
||||
, button
|
||||
[ class "btn btn-danger"
|
||||
, onClick <| LogoutClient client
|
||||
]
|
||||
[ text "Logout" ]
|
||||
, if isCurrentUser then
|
||||
text ""
|
||||
else
|
||||
button
|
||||
[ class "btn btn-default"
|
||||
[ class "btn btn-primary"
|
||||
, onClick <| SwitchClient client
|
||||
]
|
||||
[ text "Use" ]
|
||||
|
Loading…
Reference in New Issue
Block a user