File tree Expand file tree Collapse file tree 5 files changed +12
-8
lines changed
projects/packages/forms/src/store Expand file tree Collapse file tree 5 files changed +12
-8
lines changed Original file line number Diff line number Diff line change 1- import { __ } from '@wordpress/i18n ' ;
1+ import { UNKNOWN_ERROR_MESSAGE } from '../constants ' ;
22import {
33 RECEIVE_CONFIG ,
44 RECEIVE_CONFIG_VALUE ,
@@ -36,7 +36,7 @@ export default function reducer(
3636 return {
3737 ...state ,
3838 isLoading : false ,
39- error : action . error ?? __ ( 'Unknown error' , 'jetpack-forms' ) ,
39+ error : action . error ?? UNKNOWN_ERROR_MESSAGE ,
4040 } ;
4141 case RECEIVE_CONFIG :
4242 return {
Original file line number Diff line number Diff line change 11import apiFetch from '@wordpress/api-fetch' ;
2- import { __ } from '@wordpress/i18n ' ;
2+ import { UNKNOWN_ERROR_MESSAGE } from '../constants ' ;
33import { INVALIDATE_CONFIG } from './action-types' ;
44import { receiveConfig , setConfigError , setConfigLoading } from './actions' ;
55import type { ConfigAction , ConfigState } from './types' ;
@@ -13,7 +13,7 @@ const fetchConfigData = async ( dispatch: ( action: ConfigAction ) => void ) =>
1313 } ) ;
1414 dispatch ( receiveConfig ( result ) ) ;
1515 } catch ( e ) {
16- const message = e instanceof Error ? e . message : __ ( 'Unknown error' , 'jetpack-forms' ) ;
16+ const message = e instanceof Error ? e . message : UNKNOWN_ERROR_MESSAGE ;
1717 dispatch ( setConfigError ( message ) ) ;
1818 } finally {
1919 dispatch ( setConfigLoading ( false ) ) ;
Original file line number Diff line number Diff line change 1+ import { __ } from '@wordpress/i18n' ;
2+
3+ const UNKNOWN_ERROR_MESSAGE = __ ( 'Unknown error' , 'jetpack-forms' ) ;
4+ export { UNKNOWN_ERROR_MESSAGE } ;
Original file line number Diff line number Diff line change 1- import { __ } from '@wordpress/i18n ' ;
1+ import { UNKNOWN_ERROR_MESSAGE } from '../constants ' ;
22import {
33 RECEIVE_INTEGRATIONS ,
44 INVALIDATE_INTEGRATIONS ,
@@ -35,7 +35,7 @@ export default function reducer(
3535 return {
3636 ...state ,
3737 isLoading : false ,
38- error : action . error ?? __ ( 'Unknown error' , 'jetpack-forms' ) ,
38+ error : action . error ?? UNKNOWN_ERROR_MESSAGE ,
3939 } ;
4040 case RECEIVE_INTEGRATIONS :
4141 return {
Original file line number Diff line number Diff line change 11import apiFetch from '@wordpress/api-fetch' ;
2- import { __ } from '@wordpress/i18n' ;
32import { addQueryArgs } from '@wordpress/url' ;
3+ import { UNKNOWN_ERROR_MESSAGE } from '../constants' ;
44import { INVALIDATE_INTEGRATIONS } from './action-types' ;
55import { receiveIntegrations , setIntegrationsError , setIntegrationsLoading } from './actions' ;
66import type { IntegrationsAction } from './types' ;
@@ -15,7 +15,7 @@ export const getIntegrations =
1515 const result = await apiFetch < Integration [ ] > ( { path } ) ;
1616 dispatch ( receiveIntegrations ( result ) ) ;
1717 } catch ( e ) {
18- const message = e instanceof Error ? e . message : __ ( 'Unknown error' , 'jetpack-forms' ) ;
18+ const message = e instanceof Error ? e . message : UNKNOWN_ERROR_MESSAGE ;
1919 dispatch ( setIntegrationsError ( message ) ) ;
2020 } finally {
2121 dispatch ( setIntegrationsLoading ( false ) ) ;
You can’t perform that action at this time.
0 commit comments