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;
|
white-space: nowrap;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
text-overflow: ellipsis;
|
text-overflow: ellipsis;
|
||||||
|
margin-left: 3px;
|
||||||
}
|
}
|
||||||
|
|
|
@ -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
|
||||||
|
|
|
@ -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 ) =
|
||||||
|
|
|
@ -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" ]
|
||||||
|
|
Loading…
Reference in New Issue