pl-fe: migrate auth reducer to mutative

Signed-off-by: marcin mikołajczak <git@mkljczk.pl>
This commit is contained in:
marcin mikołajczak
2024-11-11 12:47:00 +01:00
parent 865130c55a
commit 09ef91cfc8
7 changed files with 165 additions and 155 deletions

View File

@@ -30,7 +30,7 @@ const getUserToken = (state: RootState, accountId?: string | false | null) => {
if (!accountId) return;
const accountUrl = selectAccount(state, accountId)?.url;
if (!accountUrl) return;
return state.auth.users.get(accountUrl)?.access_token;
return state.auth.users[accountUrl]?.access_token;
};
const getAccessToken = (state: RootState) => {
@@ -42,7 +42,7 @@ const getAuthUserId = (state: RootState) => {
const me = state.auth.me;
return [
state.auth.users.get(me!)?.id,
state.auth.users[me!]?.id,
me,
].filter(id => id).find(validId);
};
@@ -51,7 +51,7 @@ const getAuthUserUrl = (state: RootState) => {
const me = state.auth.me;
return [
state.auth.users.get(me!)?.url,
state.auth.users[me!]?.url,
me,
].filter(url => url).find(isURL);
};