mirror of
https://github.com/invoke-ai/InvokeAI
synced 2024-08-30 20:32:17 +00:00
fix(ui): fix thunks not using configured api client
This commit is contained in:
parent
3619c86f07
commit
8bacee115a
@ -4,8 +4,6 @@ import { size } from 'lodash-es';
|
||||
import { paths } from 'services/api/schema';
|
||||
import { $client } from 'services/api/client';
|
||||
|
||||
const { get, post, patch, del } = $client.get();
|
||||
|
||||
type GetImageUrlsArg =
|
||||
paths['/api/v1/images/{image_name}/urls']['get']['parameters']['path'];
|
||||
|
||||
@ -27,6 +25,7 @@ export const imageUrlsReceived = createAppAsyncThunk<
|
||||
GetImageUrlsThunkConfig
|
||||
>('api/imageUrlsReceived', async (arg, { rejectWithValue }) => {
|
||||
const { image_name } = arg;
|
||||
const { get } = $client.get();
|
||||
const { data, error, response } = await get(
|
||||
'/api/v1/images/{image_name}/urls',
|
||||
{
|
||||
@ -64,6 +63,7 @@ export const imageMetadataReceived = createAppAsyncThunk<
|
||||
GetImageMetadataThunkConfig
|
||||
>('api/imageMetadataReceived', async (arg, { rejectWithValue }) => {
|
||||
const { image_name } = arg;
|
||||
const { get } = $client.get();
|
||||
const { data, error, response } = await get(
|
||||
'/api/v1/images/{image_name}/metadata',
|
||||
{
|
||||
@ -151,6 +151,7 @@ export const imageUploaded = createAppAsyncThunk<
|
||||
is_intermediate,
|
||||
session_id,
|
||||
} = arg;
|
||||
const { post } = $client.get();
|
||||
const formData = new FormData();
|
||||
formData.append('file', file);
|
||||
const { data, error, response } = await post('/api/v1/images/', {
|
||||
@ -195,6 +196,7 @@ export const imageDeleted = createAppAsyncThunk<
|
||||
DeleteImageThunkConfig
|
||||
>('api/imageDeleted', async (arg, { rejectWithValue }) => {
|
||||
const { image_name } = arg;
|
||||
const { del } = $client.get();
|
||||
const { data, error, response } = await del('/api/v1/images/{image_name}', {
|
||||
params: {
|
||||
path: {
|
||||
@ -230,6 +232,7 @@ export const imageUpdated = createAppAsyncThunk<
|
||||
UpdateImageThunkConfig
|
||||
>('api/imageUpdated', async (arg, { rejectWithValue }) => {
|
||||
const { image_name, image_category, is_intermediate, session_id } = arg;
|
||||
const { patch } = $client.get();
|
||||
const { data, error, response } = await patch('/api/v1/images/{image_name}', {
|
||||
params: {
|
||||
path: {
|
||||
@ -278,6 +281,8 @@ export const receivedPageOfImages = createAppAsyncThunk<
|
||||
ListImagesArg,
|
||||
ListImagesThunkConfig
|
||||
>('api/receivedPageOfImages', async (arg, { getState, rejectWithValue }) => {
|
||||
const { get } = $client.get();
|
||||
|
||||
const state = getState();
|
||||
const { categories } = state.images;
|
||||
const { selectedBoardId } = state.boards;
|
||||
|
@ -1,5 +1,4 @@
|
||||
import { createAppAsyncThunk } from 'app/store/storeUtils';
|
||||
import { GraphExecutionState } from 'services/api/types';
|
||||
import { log } from 'app/logging/useLogger';
|
||||
import { isObject } from 'lodash-es';
|
||||
import { isAnyOf } from '@reduxjs/toolkit';
|
||||
@ -7,8 +6,6 @@ import { paths } from 'services/api/schema';
|
||||
import { $client } from 'services/api/client';
|
||||
import { O } from 'ts-toolbelt';
|
||||
|
||||
const { get, post, put, patch, del } = $client.get();
|
||||
|
||||
const sessionLog = log.child({ namespace: 'session' });
|
||||
|
||||
type CreateSessionArg = {
|
||||
@ -37,6 +34,7 @@ export const sessionCreated = createAppAsyncThunk<
|
||||
CreateSessionThunkConfig
|
||||
>('api/sessionCreated', async (arg, { rejectWithValue }) => {
|
||||
const { graph } = arg;
|
||||
const { post } = $client.get();
|
||||
const { data, error, response } = await post('/api/v1/sessions/', {
|
||||
body: graph,
|
||||
});
|
||||
@ -74,6 +72,7 @@ export const sessionInvoked = createAppAsyncThunk<
|
||||
InvokedSessionThunkConfig
|
||||
>('api/sessionInvoked', async (arg, { rejectWithValue }) => {
|
||||
const { session_id } = arg;
|
||||
const { put } = $client.get();
|
||||
const { data, error, response } = await put(
|
||||
'/api/v1/sessions/{session_id}/invoke',
|
||||
{
|
||||
@ -111,7 +110,7 @@ export const sessionCanceled = createAppAsyncThunk<
|
||||
CancelSessionThunkConfig
|
||||
>('api/sessionCanceled', async (arg, { rejectWithValue }) => {
|
||||
const { session_id } = arg;
|
||||
|
||||
const { del } = $client.get();
|
||||
const { data, error, response } = await del(
|
||||
'/api/v1/sessions/{session_id}/invoke',
|
||||
{
|
||||
@ -151,6 +150,7 @@ export const listedSessions = createAppAsyncThunk<
|
||||
ListSessionsThunkConfig
|
||||
>('api/listSessions', async (arg, { rejectWithValue }) => {
|
||||
const { params } = arg;
|
||||
const { get } = $client.get();
|
||||
const { data, error, response } = await get('/api/v1/sessions/', {
|
||||
params,
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user