mirror of
https://github.com/invoke-ai/InvokeAI
synced 2024-08-30 20:32:17 +00:00
feat(ui): make thunk types more consistent
This commit is contained in:
parent
30b61ae8d4
commit
01607c961f
@ -12,13 +12,13 @@ import { buildGraph } from 'common/util/buildGraph';
|
|||||||
* Would really like for this to be generated but it's easy enough to extract it.
|
* Would really like for this to be generated but it's easy enough to extract it.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
type CreateSessionRequestBody = Parameters<
|
type CreateSessionArg = Parameters<
|
||||||
(typeof SessionsService)['createSession']
|
(typeof SessionsService)['createSession']
|
||||||
>[0]['requestBody'];
|
>[0];
|
||||||
|
|
||||||
export const createSession = createAppAsyncThunk(
|
export const createSession = createAppAsyncThunk(
|
||||||
'api/createSession',
|
'api/createSession',
|
||||||
async (arg: CreateSessionRequestBody, _thunkApi) => {
|
async (arg: CreateSessionArg['requestBody'], _thunkApi) => {
|
||||||
let graph = arg;
|
let graph = arg;
|
||||||
if (!arg) {
|
if (!arg) {
|
||||||
const { getState } = _thunkApi;
|
const { getState } = _thunkApi;
|
||||||
@ -38,13 +38,14 @@ export const createSession = createAppAsyncThunk(
|
|||||||
* addNode thunk
|
* addNode thunk
|
||||||
*/
|
*/
|
||||||
|
|
||||||
type AddNodeRequestBody = Parameters<
|
type AddNodeArg = Parameters<(typeof SessionsService)['addNode']>[0];
|
||||||
(typeof SessionsService)['addNode']
|
|
||||||
>[0]['requestBody'];
|
|
||||||
|
|
||||||
export const addNode = createAppAsyncThunk(
|
export const addNode = createAppAsyncThunk(
|
||||||
'api/addNode',
|
'api/addNode',
|
||||||
async (arg: { node: AddNodeRequestBody; sessionId: string }, _thunkApi) => {
|
async (
|
||||||
|
arg: { node: AddNodeArg['requestBody']; sessionId: string },
|
||||||
|
_thunkApi
|
||||||
|
) => {
|
||||||
const response = await SessionsService.addNode({
|
const response = await SessionsService.addNode({
|
||||||
requestBody: arg.node,
|
requestBody: arg.node,
|
||||||
sessionId: arg.sessionId,
|
sessionId: arg.sessionId,
|
||||||
@ -73,12 +74,16 @@ export const invokeSession = createAppAsyncThunk(
|
|||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* invokeSession thunk
|
* cancelSession thunk
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
type CancelSessionArg = Parameters<
|
||||||
|
(typeof SessionsService)['cancelSessionInvoke']
|
||||||
|
>[0];
|
||||||
|
|
||||||
export const cancelProcessing = createAppAsyncThunk(
|
export const cancelProcessing = createAppAsyncThunk(
|
||||||
'api/cancelProcessing',
|
'api/cancelProcessing',
|
||||||
async (arg: { sessionId: string }, _thunkApi) => {
|
async (arg: CancelSessionArg, _thunkApi) => {
|
||||||
const { sessionId } = arg;
|
const { sessionId } = arg;
|
||||||
|
|
||||||
const response = await SessionsService.cancelSessionInvoke({
|
const response = await SessionsService.cancelSessionInvoke({
|
||||||
|
Loading…
Reference in New Issue
Block a user