Move isLoggedIn to utils/auth.js
This commit is contained in:
parent
007527328e
commit
71c62c05b8
|
@ -6,7 +6,7 @@ import {
|
|||
importFetchedAccounts,
|
||||
importErrorWhileFetchingAccountByUsername,
|
||||
} from './importer';
|
||||
import { isLoggedIn } from 'soapbox/utils/accounts';
|
||||
import { isLoggedIn } from 'soapbox/utils/auth';
|
||||
|
||||
export const ACCOUNT_FETCH_REQUEST = 'ACCOUNT_FETCH_REQUEST';
|
||||
export const ACCOUNT_FETCH_SUCCESS = 'ACCOUNT_FETCH_SUCCESS';
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import api, { getLinks } from '../api';
|
||||
import { fetchRelationships } from './accounts';
|
||||
import { importFetchedAccounts } from './importer';
|
||||
import { isLoggedIn } from 'soapbox/utils/accounts';
|
||||
import { isLoggedIn } from 'soapbox/utils/auth';
|
||||
|
||||
export const BLOCKS_FETCH_REQUEST = 'BLOCKS_FETCH_REQUEST';
|
||||
export const BLOCKS_FETCH_SUCCESS = 'BLOCKS_FETCH_SUCCESS';
|
||||
|
|
|
@ -13,7 +13,7 @@ import { openModal, closeModal } from './modal';
|
|||
import { getSettings } from './settings';
|
||||
import { getFeatures } from 'soapbox/utils/features';
|
||||
import { uploadMedia } from './media';
|
||||
import { isLoggedIn } from 'soapbox/utils/accounts';
|
||||
import { isLoggedIn } from 'soapbox/utils/auth';
|
||||
|
||||
let cancelFetchComposeSuggestionsAccounts;
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@ import {
|
|||
importFetchedStatuses,
|
||||
importFetchedStatus,
|
||||
} from './importer';
|
||||
import { isLoggedIn } from 'soapbox/utils/accounts';
|
||||
import { isLoggedIn } from 'soapbox/utils/auth';
|
||||
|
||||
export const CONVERSATIONS_MOUNT = 'CONVERSATIONS_MOUNT';
|
||||
export const CONVERSATIONS_UNMOUNT = 'CONVERSATIONS_UNMOUNT';
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import api, { getLinks } from '../api';
|
||||
import { isLoggedIn } from 'soapbox/utils/accounts';
|
||||
import { isLoggedIn } from 'soapbox/utils/auth';
|
||||
|
||||
export const DOMAIN_BLOCK_REQUEST = 'DOMAIN_BLOCK_REQUEST';
|
||||
export const DOMAIN_BLOCK_SUCCESS = 'DOMAIN_BLOCK_SUCCESS';
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import api from '../api';
|
||||
import { importFetchedAccounts, importFetchedStatus } from './importer';
|
||||
import { favourite, unfavourite } from './interactions';
|
||||
import { isLoggedIn } from 'soapbox/utils/accounts';
|
||||
import { isLoggedIn } from 'soapbox/utils/auth';
|
||||
|
||||
export const EMOJI_REACT_REQUEST = 'EMOJI_REACT_REQUEST';
|
||||
export const EMOJI_REACT_SUCCESS = 'EMOJI_REACT_SUCCESS';
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import api, { getLinks } from '../api';
|
||||
import { importFetchedStatuses } from './importer';
|
||||
import { isLoggedIn } from 'soapbox/utils/accounts';
|
||||
import { isLoggedIn } from 'soapbox/utils/auth';
|
||||
|
||||
export const FAVOURITED_STATUSES_FETCH_REQUEST = 'FAVOURITED_STATUSES_FETCH_REQUEST';
|
||||
export const FAVOURITED_STATUSES_FETCH_SUCCESS = 'FAVOURITED_STATUSES_FETCH_SUCCESS';
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import api from '../api';
|
||||
import snackbar from 'soapbox/actions/snackbar';
|
||||
import { isLoggedIn } from 'soapbox/utils/accounts';
|
||||
import { isLoggedIn } from 'soapbox/utils/auth';
|
||||
|
||||
export const FILTERS_FETCH_REQUEST = 'FILTERS_FETCH_REQUEST';
|
||||
export const FILTERS_FETCH_SUCCESS = 'FILTERS_FETCH_SUCCESS';
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import api from '../api';
|
||||
import { isLoggedIn } from 'soapbox/utils/accounts';
|
||||
import { isLoggedIn } from 'soapbox/utils/auth';
|
||||
|
||||
export const GROUP_CREATE_REQUEST = 'GROUP_CREATE_REQUEST';
|
||||
export const GROUP_CREATE_SUCCESS = 'GROUP_CREATE_SUCCESS';
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import api, { getLinks } from '../api';
|
||||
import { importFetchedAccounts } from './importer';
|
||||
import { fetchRelationships } from './accounts';
|
||||
import { isLoggedIn } from 'soapbox/utils/accounts';
|
||||
import { isLoggedIn } from 'soapbox/utils/auth';
|
||||
|
||||
export const GROUP_FETCH_REQUEST = 'GROUP_FETCH_REQUEST';
|
||||
export const GROUP_FETCH_SUCCESS = 'GROUP_FETCH_SUCCESS';
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import api from '../api';
|
||||
import { importFetchedAccounts, importFetchedStatus } from './importer';
|
||||
import snackbar from 'soapbox/actions/snackbar';
|
||||
import { isLoggedIn } from 'soapbox/utils/accounts';
|
||||
import { isLoggedIn } from 'soapbox/utils/auth';
|
||||
|
||||
export const REBLOG_REQUEST = 'REBLOG_REQUEST';
|
||||
export const REBLOG_SUCCESS = 'REBLOG_SUCCESS';
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import api from '../api';
|
||||
import { importFetchedAccounts } from './importer';
|
||||
import { showAlertForError } from './alerts';
|
||||
import { isLoggedIn } from 'soapbox/utils/accounts';
|
||||
import { isLoggedIn } from 'soapbox/utils/auth';
|
||||
|
||||
export const LIST_FETCH_REQUEST = 'LIST_FETCH_REQUEST';
|
||||
export const LIST_FETCH_SUCCESS = 'LIST_FETCH_SUCCESS';
|
||||
|
|
|
@ -2,7 +2,7 @@ import api, { getLinks } from '../api';
|
|||
import { fetchRelationships } from './accounts';
|
||||
import { importFetchedAccounts } from './importer';
|
||||
import { openModal } from './modal';
|
||||
import { isLoggedIn } from 'soapbox/utils/accounts';
|
||||
import { isLoggedIn } from 'soapbox/utils/auth';
|
||||
|
||||
export const MUTES_FETCH_REQUEST = 'MUTES_FETCH_REQUEST';
|
||||
export const MUTES_FETCH_SUCCESS = 'MUTES_FETCH_SUCCESS';
|
||||
|
|
|
@ -17,7 +17,7 @@ import {
|
|||
} from 'immutable';
|
||||
import { unescapeHTML } from '../utils/html';
|
||||
import { getFilters, regexFromFilters } from '../selectors';
|
||||
import { isLoggedIn } from 'soapbox/utils/accounts';
|
||||
import { isLoggedIn } from 'soapbox/utils/auth';
|
||||
|
||||
export const NOTIFICATIONS_UPDATE = 'NOTIFICATIONS_UPDATE';
|
||||
export const NOTIFICATIONS_UPDATE_NOOP = 'NOTIFICATIONS_UPDATE_NOOP';
|
||||
|
|
|
@ -2,7 +2,7 @@ import { debounce } from 'lodash';
|
|||
import { showAlertForError } from './alerts';
|
||||
import { patchMe } from 'soapbox/actions/me';
|
||||
import { Map as ImmutableMap, List as ImmutableList } from 'immutable';
|
||||
import { isLoggedIn } from 'soapbox/utils/accounts';
|
||||
import { isLoggedIn } from 'soapbox/utils/auth';
|
||||
import uuid from '../uuid';
|
||||
|
||||
export const SETTING_CHANGE = 'SETTING_CHANGE';
|
||||
|
|
|
@ -4,7 +4,7 @@ import { evictStatus } from '../storage/modifier';
|
|||
import { deleteFromTimelines } from './timelines';
|
||||
import { importFetchedStatus, importFetchedStatuses, importAccount, importStatus } from './importer';
|
||||
import { openModal } from './modal';
|
||||
import { isLoggedIn } from 'soapbox/utils/accounts';
|
||||
import { isLoggedIn } from 'soapbox/utils/auth';
|
||||
|
||||
export const STATUS_FETCH_REQUEST = 'STATUS_FETCH_REQUEST';
|
||||
export const STATUS_FETCH_SUCCESS = 'STATUS_FETCH_SUCCESS';
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import api from '../api';
|
||||
import { importFetchedAccounts } from './importer';
|
||||
import { isLoggedIn } from 'soapbox/utils/accounts';
|
||||
import { isLoggedIn } from 'soapbox/utils/auth';
|
||||
|
||||
export const SUGGESTIONS_FETCH_REQUEST = 'SUGGESTIONS_FETCH_REQUEST';
|
||||
export const SUGGESTIONS_FETCH_SUCCESS = 'SUGGESTIONS_FETCH_SUCCESS';
|
||||
|
|
|
@ -49,5 +49,3 @@ export const isLocal = account => {
|
|||
export const isVerified = account => (
|
||||
account.getIn(['pleroma', 'tags'], ImmutableList()).includes('verified')
|
||||
);
|
||||
|
||||
export const isLoggedIn = getState => typeof getState().get('me') === 'string';
|
||||
|
|
|
@ -1,3 +1,7 @@
|
|||
export const isLoggedIn = getState => {
|
||||
return typeof getState().get('me') === 'string';
|
||||
};
|
||||
|
||||
export const getAccessToken = state => {
|
||||
const me = state.getIn(['auth', 'me']);
|
||||
return state.getIn(['auth', 'users', me, 'access_token']);
|
||||
|
|
Loading…
Reference in New Issue