Better actions names for INSTANCE_FETCH_SUCCESS etc
This commit is contained in:
parent
e8fcd9bf18
commit
8f566b70e6
4 changed files with 18 additions and 18 deletions
|
@ -2,10 +2,10 @@ import api from '../api';
|
||||||
import { get } from 'lodash';
|
import { get } from 'lodash';
|
||||||
import { parseVersion } from 'soapbox/utils/features';
|
import { parseVersion } from 'soapbox/utils/features';
|
||||||
|
|
||||||
export const INSTANCE_IMPORT = 'INSTANCE_IMPORT';
|
export const INSTANCE_FETCH_SUCCESS = 'INSTANCE_FETCH_SUCCESS';
|
||||||
export const INSTANCE_FAIL = 'INSTANCE_FAIL';
|
export const INSTANCE_FETCH_FAIL = 'INSTANCE_FETCH_FAIL';
|
||||||
export const NODEINFO_IMPORT = 'NODEINFO_IMPORT';
|
export const NODEINFO_FETCH_SUCCESS = 'NODEINFO_FETCH_SUCCESS';
|
||||||
export const NODEINFO_FAIL = 'NODEINFO_FAIL';
|
export const NODEINFO_FETCH_FAIL = 'NODEINFO_FETCH_FAIL';
|
||||||
|
|
||||||
export function fetchInstance() {
|
export function fetchInstance() {
|
||||||
return (dispatch, getState) => {
|
return (dispatch, getState) => {
|
||||||
|
@ -33,14 +33,14 @@ export function fetchNodeinfo() {
|
||||||
|
|
||||||
export function importInstance(instance) {
|
export function importInstance(instance) {
|
||||||
return {
|
return {
|
||||||
type: INSTANCE_IMPORT,
|
type: INSTANCE_FETCH_SUCCESS,
|
||||||
instance,
|
instance,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
export function instanceFail(error) {
|
export function instanceFail(error) {
|
||||||
return {
|
return {
|
||||||
type: INSTANCE_FAIL,
|
type: INSTANCE_FETCH_FAIL,
|
||||||
error,
|
error,
|
||||||
skipAlert: true,
|
skipAlert: true,
|
||||||
};
|
};
|
||||||
|
@ -48,14 +48,14 @@ export function instanceFail(error) {
|
||||||
|
|
||||||
export function importNodeinfo(nodeinfo) {
|
export function importNodeinfo(nodeinfo) {
|
||||||
return {
|
return {
|
||||||
type: NODEINFO_IMPORT,
|
type: NODEINFO_FETCH_SUCCESS,
|
||||||
nodeinfo,
|
nodeinfo,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
export function nodeinfoFail(error) {
|
export function nodeinfoFail(error) {
|
||||||
return {
|
return {
|
||||||
type: NODEINFO_FAIL,
|
type: NODEINFO_FETCH_FAIL,
|
||||||
error,
|
error,
|
||||||
skipAlert: true,
|
skipAlert: true,
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import api from '../api';
|
import api from '../api';
|
||||||
|
|
||||||
export const SOAPBOX_CONFIG_IMPORT = 'SOAPBOX_CONFIG_IMPORT';
|
export const SOAPBOX_CONFIG_REQUEST_SUCCESS = 'SOAPBOX_CONFIG_REQUEST_SUCCESS';
|
||||||
export const SOAPBOX_CONFIG_FAIL = 'SOAPBOX_CONFIG_FAIL';
|
export const SOAPBOX_CONFIG_REQUEST_FAIL = 'SOAPBOX_CONFIG_REQUEST_FAIL';
|
||||||
|
|
||||||
export function fetchSoapboxConfig() {
|
export function fetchSoapboxConfig() {
|
||||||
return (dispatch, getState) => {
|
return (dispatch, getState) => {
|
||||||
|
@ -15,14 +15,14 @@ export function fetchSoapboxConfig() {
|
||||||
|
|
||||||
export function importSoapboxConfig(soapboxConfig) {
|
export function importSoapboxConfig(soapboxConfig) {
|
||||||
return {
|
return {
|
||||||
type: SOAPBOX_CONFIG_IMPORT,
|
type: SOAPBOX_CONFIG_REQUEST_SUCCESS,
|
||||||
soapboxConfig,
|
soapboxConfig,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
export function soapboxConfigFail(error) {
|
export function soapboxConfigFail(error) {
|
||||||
return {
|
return {
|
||||||
type: SOAPBOX_CONFIG_FAIL,
|
type: SOAPBOX_CONFIG_REQUEST_FAIL,
|
||||||
error,
|
error,
|
||||||
skipAlert: true,
|
skipAlert: true,
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import {
|
import {
|
||||||
INSTANCE_IMPORT,
|
INSTANCE_FETCH_SUCCESS,
|
||||||
NODEINFO_IMPORT,
|
NODEINFO_FETCH_SUCCESS,
|
||||||
} from '../actions/instance';
|
} from '../actions/instance';
|
||||||
import { Map as ImmutableMap, fromJS } from 'immutable';
|
import { Map as ImmutableMap, fromJS } from 'immutable';
|
||||||
|
|
||||||
|
@ -30,9 +30,9 @@ const initialState = ImmutableMap({
|
||||||
|
|
||||||
export default function instance(state = initialState, action) {
|
export default function instance(state = initialState, action) {
|
||||||
switch(action.type) {
|
switch(action.type) {
|
||||||
case INSTANCE_IMPORT:
|
case INSTANCE_FETCH_SUCCESS:
|
||||||
return initialState.merge(fromJS(action.instance));
|
return initialState.merge(fromJS(action.instance));
|
||||||
case NODEINFO_IMPORT:
|
case NODEINFO_FETCH_SUCCESS:
|
||||||
return nodeinfoToInstance(fromJS(action.nodeinfo)).merge(state);
|
return nodeinfoToInstance(fromJS(action.nodeinfo)).merge(state);
|
||||||
default:
|
default:
|
||||||
return state;
|
return state;
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
import { SOAPBOX_CONFIG_IMPORT } from '../actions/soapbox';
|
import { SOAPBOX_CONFIG_REQUEST_SUCCESS } from '../actions/soapbox';
|
||||||
import { Map as ImmutableMap, fromJS } from 'immutable';
|
import { Map as ImmutableMap, fromJS } from 'immutable';
|
||||||
|
|
||||||
const initialState = ImmutableMap();
|
const initialState = ImmutableMap();
|
||||||
|
|
||||||
export default function soapbox(state = initialState, action) {
|
export default function soapbox(state = initialState, action) {
|
||||||
switch(action.type) {
|
switch(action.type) {
|
||||||
case SOAPBOX_CONFIG_IMPORT:
|
case SOAPBOX_CONFIG_REQUEST_SUCCESS:
|
||||||
return ImmutableMap(fromJS(action.soapboxConfig));
|
return ImmutableMap(fromJS(action.soapboxConfig));
|
||||||
default:
|
default:
|
||||||
return state;
|
return state;
|
||||||
|
|
Loading…
Reference in a new issue