Simplify tokenForId
This commit is contained in:
parent
e474cebcdb
commit
bc7779158c
|
@ -139,12 +139,9 @@ class AccountsStore extends ChangeNotifier {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// returns token for user of a certain id
|
/// returns token for user of a certain id
|
||||||
Jwt tokenForId(String instanceHost, int userId) =>
|
Jwt tokenForId(String instanceHost, int userId) => tokens[instanceHost]
|
||||||
tokens.containsKey(instanceHost)
|
?.values
|
||||||
? tokens[instanceHost]
|
?.firstWhere((val) => val.payload.id == userId, orElse: () => null);
|
||||||
.values
|
|
||||||
.firstWhere((val) => val.payload.id == userId, orElse: () => null)
|
|
||||||
: null;
|
|
||||||
|
|
||||||
Jwt tokenFor(String instanceHost, String username) {
|
Jwt tokenFor(String instanceHost, String username) {
|
||||||
if (!usernamesFor(instanceHost).contains(username)) {
|
if (!usernamesFor(instanceHost).contains(username)) {
|
||||||
|
|
Loading…
Reference in New Issue