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 { parseVersion } from 'soapbox/utils/features';
|
||||
|
||||
export const INSTANCE_IMPORT = 'INSTANCE_IMPORT';
|
||||
export const INSTANCE_FAIL = 'INSTANCE_FAIL';
|
||||
export const NODEINFO_IMPORT = 'NODEINFO_IMPORT';
|
||||
export const NODEINFO_FAIL = 'NODEINFO_FAIL';
|
||||
export const INSTANCE_FETCH_SUCCESS = 'INSTANCE_FETCH_SUCCESS';
|
||||
export const INSTANCE_FETCH_FAIL = 'INSTANCE_FETCH_FAIL';
|
||||
export const NODEINFO_FETCH_SUCCESS = 'NODEINFO_FETCH_SUCCESS';
|
||||
export const NODEINFO_FETCH_FAIL = 'NODEINFO_FETCH_FAIL';
|
||||
|
||||
export function fetchInstance() {
|
||||
return (dispatch, getState) => {
|
||||
|
@ -33,14 +33,14 @@ export function fetchNodeinfo() {
|
|||
|
||||
export function importInstance(instance) {
|
||||
return {
|
||||
type: INSTANCE_IMPORT,
|
||||
type: INSTANCE_FETCH_SUCCESS,
|
||||
instance,
|
||||
};
|
||||
}
|
||||
|
||||
export function instanceFail(error) {
|
||||
return {
|
||||
type: INSTANCE_FAIL,
|
||||
type: INSTANCE_FETCH_FAIL,
|
||||
error,
|
||||
skipAlert: true,
|
||||
};
|
||||
|
@ -48,14 +48,14 @@ export function instanceFail(error) {
|
|||
|
||||
export function importNodeinfo(nodeinfo) {
|
||||
return {
|
||||
type: NODEINFO_IMPORT,
|
||||
type: NODEINFO_FETCH_SUCCESS,
|
||||
nodeinfo,
|
||||
};
|
||||
}
|
||||
|
||||
export function nodeinfoFail(error) {
|
||||
return {
|
||||
type: NODEINFO_FAIL,
|
||||
type: NODEINFO_FETCH_FAIL,
|
||||
error,
|
||||
skipAlert: true,
|
||||
};
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import api from '../api';
|
||||
|
||||
export const SOAPBOX_CONFIG_IMPORT = 'SOAPBOX_CONFIG_IMPORT';
|
||||
export const SOAPBOX_CONFIG_FAIL = 'SOAPBOX_CONFIG_FAIL';
|
||||
export const SOAPBOX_CONFIG_REQUEST_SUCCESS = 'SOAPBOX_CONFIG_REQUEST_SUCCESS';
|
||||
export const SOAPBOX_CONFIG_REQUEST_FAIL = 'SOAPBOX_CONFIG_REQUEST_FAIL';
|
||||
|
||||
export function fetchSoapboxConfig() {
|
||||
return (dispatch, getState) => {
|
||||
|
@ -15,14 +15,14 @@ export function fetchSoapboxConfig() {
|
|||
|
||||
export function importSoapboxConfig(soapboxConfig) {
|
||||
return {
|
||||
type: SOAPBOX_CONFIG_IMPORT,
|
||||
type: SOAPBOX_CONFIG_REQUEST_SUCCESS,
|
||||
soapboxConfig,
|
||||
};
|
||||
}
|
||||
|
||||
export function soapboxConfigFail(error) {
|
||||
return {
|
||||
type: SOAPBOX_CONFIG_FAIL,
|
||||
type: SOAPBOX_CONFIG_REQUEST_FAIL,
|
||||
error,
|
||||
skipAlert: true,
|
||||
};
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import {
|
||||
INSTANCE_IMPORT,
|
||||
NODEINFO_IMPORT,
|
||||
INSTANCE_FETCH_SUCCESS,
|
||||
NODEINFO_FETCH_SUCCESS,
|
||||
} from '../actions/instance';
|
||||
import { Map as ImmutableMap, fromJS } from 'immutable';
|
||||
|
||||
|
@ -30,9 +30,9 @@ const initialState = ImmutableMap({
|
|||
|
||||
export default function instance(state = initialState, action) {
|
||||
switch(action.type) {
|
||||
case INSTANCE_IMPORT:
|
||||
case INSTANCE_FETCH_SUCCESS:
|
||||
return initialState.merge(fromJS(action.instance));
|
||||
case NODEINFO_IMPORT:
|
||||
case NODEINFO_FETCH_SUCCESS:
|
||||
return nodeinfoToInstance(fromJS(action.nodeinfo)).merge(state);
|
||||
default:
|
||||
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';
|
||||
|
||||
const initialState = ImmutableMap();
|
||||
|
||||
export default function soapbox(state = initialState, action) {
|
||||
switch(action.type) {
|
||||
case SOAPBOX_CONFIG_IMPORT:
|
||||
case SOAPBOX_CONFIG_REQUEST_SUCCESS:
|
||||
return ImmutableMap(fromJS(action.soapboxConfig));
|
||||
default:
|
||||
return state;
|
||||
|
|
Loading…
Reference in a new issue