createAsyncThunk(): .toString() --> .type

revert-5af0e40a
Alex Gleason 2022-04-25 15:47:47 -05:00
rodzic 928cf90c8f
commit 19d579c2a0
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 7211D1F99744FBB7
4 zmienionych plików z 12 dodań i 12 usunięć

Wyświetl plik

@ -9,7 +9,7 @@ describe('<LandingPage />', () => {
it('renders a RegistrationForm for an open Pleroma instance', () => {
const state = rootReducer(undefined, {
type: rememberInstance.fulfilled.toString(),
type: rememberInstance.fulfilled.type,
payload: {
version: '2.7.2 (compatible; Pleroma 2.3.0)',
registrations: true,
@ -26,7 +26,7 @@ describe('<LandingPage />', () => {
it('renders "closed" message for a closed Pleroma instance', () => {
const state = rootReducer(undefined, {
type: rememberInstance.fulfilled.toString(),
type: rememberInstance.fulfilled.type,
payload: {
version: '2.7.2 (compatible; Pleroma 2.3.0)',
registrations: false,
@ -43,7 +43,7 @@ describe('<LandingPage />', () => {
it('renders Pepe flow for an open Truth Social instance', () => {
const state = applyActions(undefined, [{
type: rememberInstance.fulfilled.toString(),
type: rememberInstance.fulfilled.type,
payload: {
version: '3.4.1 (compatible; TruthSocial 1.0.0)',
registrations: false,
@ -65,7 +65,7 @@ describe('<LandingPage />', () => {
it('renders "closed" message for a Truth Social instance with Pepe closed', () => {
const state = applyActions(undefined, [{
type: rememberInstance.fulfilled.toString(),
type: rememberInstance.fulfilled.type,
payload: {
version: '3.4.1 (compatible; TruthSocial 1.0.0)',
registrations: false,

Wyświetl plik

@ -33,7 +33,7 @@ describe('instance reducer', () => {
describe('rememberInstance.fulfilled', () => {
it('normalizes Pleroma instance with Mastodon configuration format', () => {
const action = {
type: rememberInstance.fulfilled.toString(),
type: rememberInstance.fulfilled.type,
payload: require('soapbox/__fixtures__/pleroma-instance.json'),
};
@ -59,7 +59,7 @@ describe('instance reducer', () => {
it('normalizes Mastodon instance with retained configuration', () => {
const action = {
type: rememberInstance.fulfilled.toString(),
type: rememberInstance.fulfilled.type,
payload: require('soapbox/__fixtures__/mastodon-instance.json'),
};
@ -93,7 +93,7 @@ describe('instance reducer', () => {
it('normalizes Mastodon 3.0.0 instance with default configuration', () => {
const action = {
type: rememberInstance.fulfilled.toString(),
type: rememberInstance.fulfilled.type,
payload: require('soapbox/__fixtures__/mastodon-3.0.0-instance.json'),
};

Wyświetl plik

@ -114,14 +114,14 @@ export default function instance(state = initialState, action: AnyAction) {
switch(action.type) {
case PLEROMA_PRELOAD_IMPORT:
return preloadImport(state, action, '/api/v1/instance');
case rememberInstance.fulfilled.toString():
case rememberInstance.fulfilled.type:
return importInstance(state, ImmutableMap(fromJS(action.payload)));
case fetchInstance.fulfilled.toString():
case fetchInstance.fulfilled.type:
persistInstance(action.payload);
return importInstance(state, ImmutableMap(fromJS(action.payload)));
case fetchInstance.rejected.toString():
case fetchInstance.rejected.type:
return handleInstanceFetchFail(state, action.error);
case fetchNodeinfo.fulfilled.toString():
case fetchNodeinfo.fulfilled.type:
return importNodeinfo(state, ImmutableMap(fromJS(action.payload)));
case ADMIN_CONFIG_UPDATE_REQUEST:
case ADMIN_CONFIG_UPDATE_SUCCESS:

Wyświetl plik

@ -12,7 +12,7 @@ const ReducerRecord = ImmutableRecord({
export default function meta(state = ReducerRecord(), action: AnyAction) {
switch(action.type) {
case fetchInstance.rejected.toString():
case fetchInstance.rejected.type:
return state.set('instance_fetch_failed', true);
default:
return state;