From 674ffed6a55ae1c2bae23e2775fa8140d6bc0dd4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?marcin=20miko=C5=82ajczak?= Date: Sat, 31 Dec 2022 19:48:31 +0100 Subject: [PATCH] =?UTF-8?q?=C2=A0These=20params=20should=20never=20be=20nu?= =?UTF-8?q?ll,=20actually?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: marcin mikołajczak --- app/soapbox/actions/auth.ts | 4 ++-- app/soapbox/features/auth-token-list/index.tsx | 2 +- app/soapbox/reducers/auth.ts | 14 +++++++------- app/soapbox/selectors/index.ts | 4 ++-- 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/app/soapbox/actions/auth.ts b/app/soapbox/actions/auth.ts index df5f47f16..436c87ff2 100644 --- a/app/soapbox/actions/auth.ts +++ b/app/soapbox/actions/auth.ts @@ -214,7 +214,7 @@ export const logOut = () => const params = { client_id: state.auth.app.client_id!, client_secret: state.auth.app.client_secret!, - token: state.auth.users.get(account.url)?.access_token!, + token: state.auth.users.get(account.url)!.access_token, }; return dispatch(revokeOAuthToken(params)) @@ -245,7 +245,7 @@ export const fetchOwnAccounts = () => return state.auth.users.forEach((user) => { const account = state.accounts.get(user.id); if (!account) { - dispatch(verifyCredentials(user.access_token!, user.url!)); + dispatch(verifyCredentials(user.access_token, user.url)); } }); }; diff --git a/app/soapbox/features/auth-token-list/index.tsx b/app/soapbox/features/auth-token-list/index.tsx index c7830310f..360c05a47 100644 --- a/app/soapbox/features/auth-token-list/index.tsx +++ b/app/soapbox/features/auth-token-list/index.tsx @@ -75,7 +75,7 @@ const AuthTokenList: React.FC = () => { const currentTokenId = useAppSelector(state => { const currentToken = state.auth.tokens.valueSeq().find((token) => token.me === state.auth.me); - return currentToken?.get('id'); + return currentToken?.id; }); useEffect(() => { diff --git a/app/soapbox/reducers/auth.ts b/app/soapbox/reducers/auth.ts index 47aadcb0a..85b8159b4 100644 --- a/app/soapbox/reducers/auth.ts +++ b/app/soapbox/reducers/auth.ts @@ -34,21 +34,21 @@ export const AuthAppRecord = ImmutableRecord({ }); export const AuthTokenRecord = ImmutableRecord({ - access_token: null as string | null, + access_token: '', account: null as string | null, - created_at: null as number | null, + created_at: 0, expires_in: null as number | null, id: null as number | null, me: null as string | null, refresh_token: null as string | null, - scope: null as string | null, - token_type: null as string | null, + scope: '', + token_type: '', }); export const AuthUserRecord = ImmutableRecord({ - access_token: null as string | null, - id: null as string | null, - url: null as string | null, + access_token: '', + id: '', + url: '', }); export const ReducerRecord = ImmutableRecord({ diff --git a/app/soapbox/selectors/index.ts b/app/soapbox/selectors/index.ts index 77a64a212..b8303c0db 100644 --- a/app/soapbox/selectors/index.ts +++ b/app/soapbox/selectors/index.ts @@ -273,8 +273,8 @@ const getAuthUserIds = createSelector([ ], authUsers => { return authUsers.reduce((ids: ImmutableOrderedSet, authUser) => { try { - const id = authUser.get('id'); - return validId(id) ? ids.add(id!) : ids; + const id = authUser.id; + return validId(id) ? ids.add(id) : ids; } catch { return ids; }