These params should never be null, actually

Signed-off-by: marcin mikołajczak <git@mkljczk.pl>
This commit is contained in:
marcin mikołajczak 2022-12-31 19:48:31 +01:00
parent cbd06926f3
commit 674ffed6a5
4 changed files with 12 additions and 12 deletions

View file

@ -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));
}
});
};

View file

@ -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(() => {

View file

@ -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({

View file

@ -273,8 +273,8 @@ const getAuthUserIds = createSelector([
], authUsers => {
return authUsers.reduce((ids: ImmutableOrderedSet<string>, 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;
}