bigbuffet-rw/app/soapbox/utils/auth.js

15 lines
410 B
JavaScript
Raw Normal View History

2021-03-25 10:25:45 -07:00
export const isLoggedIn = getState => {
return typeof getState().get('me') === 'string';
};
2021-03-31 12:47:54 -07:00
export const getAppToken = state => state.getIn(['auth', 'app', 'access_token']);
export const getUserToken = (state, accountId) => {
return state.getIn(['auth', 'users', accountId, 'access_token']);
};
2021-03-24 15:53:09 -07:00
export const getAccessToken = state => {
2021-03-29 22:23:29 -07:00
const me = state.get('me');
2021-03-31 12:47:54 -07:00
return getUserToken(state, me);
2021-03-24 15:53:09 -07:00
};