1
1
import { AnyAction , Draft , createAsyncThunk , createSlice } from '@reduxjs/toolkit' ;
2
2
import * as z from 'zod' ;
3
3
4
- import { SimpleThunkAction } from '../../actions' ;
4
+ import { ThunkAction } from '../../actions' ;
5
5
import { jsonPost , routes } from '../../api' ;
6
6
import { executeRequestPayloadSelector , executeViaWebsocketSelector } from '../../selectors' ;
7
7
import { Channel , Edition , Mode } from '../../types' ;
@@ -194,7 +194,7 @@ const slice = createSlice({
194
194
export const { wsExecuteRequest } = slice . actions ;
195
195
196
196
export const performCommonExecute =
197
- ( crateType : string , tests : boolean ) : SimpleThunkAction =>
197
+ ( crateType : string , tests : boolean ) : ThunkAction =>
198
198
( dispatch , getState ) => {
199
199
const state = getState ( ) ;
200
200
const body = executeRequestPayloadSelector ( state , { crateType, tests } ) ;
@@ -208,7 +208,7 @@ export const performCommonExecute =
208
208
} ;
209
209
210
210
const dispatchWhenSequenceNumber =
211
- < A extends AnyAction > ( cb : ( sequenceNumber : number ) => A ) : SimpleThunkAction =>
211
+ < A extends AnyAction > ( cb : ( sequenceNumber : number ) => A ) : ThunkAction =>
212
212
( dispatch , getState ) => {
213
213
const state = getState ( ) ;
214
214
const { sequenceNumber } = state . output . execute ;
@@ -218,17 +218,17 @@ const dispatchWhenSequenceNumber =
218
218
}
219
219
} ;
220
220
221
- export const wsExecuteStdin = ( payload : string ) : SimpleThunkAction =>
221
+ export const wsExecuteStdin = ( payload : string ) : ThunkAction =>
222
222
dispatchWhenSequenceNumber ( ( sequenceNumber ) =>
223
223
slice . actions . wsExecuteStdin ( payload , sequenceNumber ) ,
224
224
) ;
225
225
226
- export const wsExecuteStdinClose = ( ) : SimpleThunkAction =>
226
+ export const wsExecuteStdinClose = ( ) : ThunkAction =>
227
227
dispatchWhenSequenceNumber ( ( sequenceNumber ) =>
228
228
slice . actions . wsExecuteStdinClose ( undefined , sequenceNumber ) ,
229
229
) ;
230
230
231
- export const wsExecuteKill = ( ) : SimpleThunkAction =>
231
+ export const wsExecuteKill = ( ) : ThunkAction =>
232
232
dispatchWhenSequenceNumber ( ( sequenceNumber ) =>
233
233
slice . actions . wsExecuteKill ( undefined , sequenceNumber ) ,
234
234
) ;
0 commit comments