@@ -97,7 +97,7 @@ const createGetLocalSpace = async (
97
97
type ,
98
98
flagType ,
99
99
showError = true
100
- ) => async dispatch => {
100
+ ) => async ( dispatch ) => {
101
101
const flagGettingSpace = createFlag ( flagType ) ;
102
102
try {
103
103
dispatch ( flagGettingSpace ( true ) ) ;
@@ -123,14 +123,12 @@ const createGetLocalSpace = async (
123
123
}
124
124
} ;
125
125
126
- const getLocalSpace = payload =>
126
+ const getLocalSpace = ( payload ) =>
127
127
createGetLocalSpace ( payload , GET_SPACE_SUCCEEDED , FLAG_GETTING_SPACE ) ;
128
128
129
- const createGetRemoteSpace = async (
130
- { id } ,
131
- type ,
132
- flagType
133
- ) => async dispatch => {
129
+ const createGetRemoteSpace = async ( { id } , type , flagType ) => async (
130
+ dispatch
131
+ ) => {
134
132
const flagGettingSpace = createFlag ( flagType ) ;
135
133
try {
136
134
dispatch ( flagGettingSpace ( true ) ) ;
@@ -174,10 +172,10 @@ const createGetRemoteSpace = async (
174
172
}
175
173
} ;
176
174
177
- const getRemoteSpace = payload =>
175
+ const getRemoteSpace = ( payload ) =>
178
176
createGetRemoteSpace ( payload , GET_SPACE_SUCCEEDED , FLAG_GETTING_SPACE ) ;
179
177
180
- const getSpaces = ( ) => dispatch => {
178
+ const getSpaces = ( ) => ( dispatch ) => {
181
179
dispatch ( flagGettingSpaces ( true ) ) ;
182
180
window . ipcRenderer . send ( GET_SPACES_CHANNEL ) ;
183
181
// create listener
@@ -191,7 +189,7 @@ const getSpaces = () => dispatch => {
191
189
} ) ;
192
190
} ;
193
191
194
- const saveSpace = async ( { space } ) => async dispatch => {
192
+ const saveSpace = async ( { space } ) => async ( dispatch ) => {
195
193
try {
196
194
dispatch ( flagSavingSpace ( true ) ) ;
197
195
@@ -246,14 +244,14 @@ const saveSpace = async ({ space }) => async dispatch => {
246
244
}
247
245
} ;
248
246
249
- const clearSpace = ( ) => dispatch => {
247
+ const clearSpace = ( ) => ( dispatch ) => {
250
248
dispatch ( clearPhase ( ) ) ;
251
249
return dispatch ( {
252
250
type : CLEAR_SPACE ,
253
251
} ) ;
254
252
} ;
255
253
256
- const deleteSpace = ( { id } ) => dispatch => {
254
+ const deleteSpace = ( { id } , onSuccess ) => ( dispatch ) => {
257
255
// show confirmation prompt
258
256
const buttons = [ i18n . t ( 'Cancel' ) , i18n . t ( 'Delete' ) ] ;
259
257
window . ipcRenderer . send ( SHOW_DELETE_SPACE_PROMPT_CHANNEL , {
@@ -276,6 +274,9 @@ const deleteSpace = ({ id }) => dispatch => {
276
274
i18n . t ( ERROR_DELETING_MESSAGE )
277
275
) ;
278
276
} else {
277
+ // eslint-disable-next-line no-unused-expressions
278
+ onSuccess ?. ( ) ;
279
+
279
280
// update saved spaces in state
280
281
dispatch ( getSpaces ( ) ) ;
281
282
@@ -299,7 +300,7 @@ const deleteSpace = ({ id }) => dispatch => {
299
300
} ) ;
300
301
} ;
301
302
302
- const clearUserInput = async ( { spaceId, userId } ) => async dispatch => {
303
+ const clearUserInput = async ( { spaceId, userId } ) => async ( dispatch ) => {
303
304
try {
304
305
// show confirmation prompt
305
306
const buttons = [ i18n . t ( 'Cancel' ) , i18n . t ( 'Clear' ) ] ;
@@ -346,7 +347,7 @@ const clearUserInput = async ({ spaceId, userId }) => async dispatch => {
346
347
}
347
348
} ;
348
349
349
- const getSpace = ( { id, saved = false , user } ) => dispatch => {
350
+ const getSpace = ( { id, saved = false , user } ) => ( dispatch ) => {
350
351
// only get the space from the api if not saved
351
352
if ( ! saved ) {
352
353
dispatch ( getRemoteSpace ( { id } ) ) ;
@@ -359,7 +360,7 @@ const getSpacesNearby = async ({
359
360
latitude,
360
361
longitude,
361
362
radius = DEFAULT_RADIUS ,
362
- } ) => async dispatch => {
363
+ } ) => async ( dispatch ) => {
363
364
try {
364
365
dispatch ( flagGettingSpacesNearby ( true ) ) ;
365
366
@@ -385,7 +386,7 @@ const getSpacesNearby = async ({
385
386
}
386
387
} ;
387
388
388
- const setSearchQuery = async payload => async dispatch => {
389
+ const setSearchQuery = async ( payload ) => async ( dispatch ) => {
389
390
dispatch ( {
390
391
type : SET_SPACE_SEARCH_QUERY_SUCCEEDED ,
391
392
payload,
0 commit comments