Skip API requests if logged out
This commit is contained in:
parent
3b0530073e
commit
3d76cd21e6
|
@ -6,6 +6,9 @@ export const CUSTOM_EMOJIS_FETCH_FAIL = 'CUSTOM_EMOJIS_FETCH_FAIL';
|
||||||
|
|
||||||
export function fetchCustomEmojis() {
|
export function fetchCustomEmojis() {
|
||||||
return (dispatch, getState) => {
|
return (dispatch, getState) => {
|
||||||
|
const me = getState().get('me');
|
||||||
|
if (!me) return;
|
||||||
|
|
||||||
dispatch(fetchCustomEmojisRequest());
|
dispatch(fetchCustomEmojisRequest());
|
||||||
|
|
||||||
api(getState).get('/api/v1/custom_emojis').then(response => {
|
api(getState).get('/api/v1/custom_emojis').then(response => {
|
||||||
|
|
|
@ -48,9 +48,12 @@ export function fetchSuggestionsV2(params = {}) {
|
||||||
export function fetchSuggestions(params = { limit: 50 }) {
|
export function fetchSuggestions(params = { limit: 50 }) {
|
||||||
return (dispatch, getState) => {
|
return (dispatch, getState) => {
|
||||||
const state = getState();
|
const state = getState();
|
||||||
|
const me = state.get('me');
|
||||||
const instance = state.get('instance');
|
const instance = state.get('instance');
|
||||||
const features = getFeatures(instance);
|
const features = getFeatures(instance);
|
||||||
|
|
||||||
|
if (!me) return;
|
||||||
|
|
||||||
if (features.suggestionsV2) {
|
if (features.suggestionsV2) {
|
||||||
dispatch(fetchSuggestionsV2(params))
|
dispatch(fetchSuggestionsV2(params))
|
||||||
.then(suggestions => {
|
.then(suggestions => {
|
||||||
|
|
Loading…
Reference in New Issue