mirror of
https://github.com/invoke-ai/InvokeAI
synced 2024-08-30 20:32:17 +00:00
call stylePresetSelected
This commit is contained in:
parent
cd215700fe
commit
fc39086fb4
@ -53,6 +53,7 @@ import type { AppDispatch, RootState } from 'app/store/store';
|
|||||||
|
|
||||||
import { addArchivedOrDeletedBoardListener } from './listeners/addArchivedOrDeletedBoardListener';
|
import { addArchivedOrDeletedBoardListener } from './listeners/addArchivedOrDeletedBoardListener';
|
||||||
import { addEnqueueRequestedUpscale } from './listeners/enqueueRequestedUpscale';
|
import { addEnqueueRequestedUpscale } from './listeners/enqueueRequestedUpscale';
|
||||||
|
import { addStylePresetSelectedListener } from './listeners/stylePresetSelected';
|
||||||
|
|
||||||
export const listenerMiddleware = createListenerMiddleware();
|
export const listenerMiddleware = createListenerMiddleware();
|
||||||
|
|
||||||
@ -123,6 +124,9 @@ addImageRemovedFromBoardFulfilledListener(startAppListening);
|
|||||||
addBoardIdSelectedListener(startAppListening);
|
addBoardIdSelectedListener(startAppListening);
|
||||||
addArchivedOrDeletedBoardListener(startAppListening);
|
addArchivedOrDeletedBoardListener(startAppListening);
|
||||||
|
|
||||||
|
// Style Presets
|
||||||
|
addStylePresetSelectedListener(startAppListening);
|
||||||
|
|
||||||
// Node schemas
|
// Node schemas
|
||||||
addGetOpenAPISchemaListener(startAppListening);
|
addGetOpenAPISchemaListener(startAppListening);
|
||||||
|
|
||||||
|
@ -0,0 +1,15 @@
|
|||||||
|
import type { AppStartListening } from 'app/store/middleware/listenerMiddleware';
|
||||||
|
import { activeStylePresetIdChanged } from 'features/stylePresets/store/stylePresetSlice';
|
||||||
|
import { stylePresetsApi } from 'services/api/endpoints/stylePresets';
|
||||||
|
|
||||||
|
export const addStylePresetSelectedListener = (startAppListening: AppStartListening) => {
|
||||||
|
startAppListening({
|
||||||
|
actionCreator: activeStylePresetIdChanged,
|
||||||
|
effect: async (action, { dispatch }) => {
|
||||||
|
if (!action.payload) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
dispatch(stylePresetsApi.endpoints.selectStylePreset.initiate(action.payload));
|
||||||
|
},
|
||||||
|
});
|
||||||
|
};
|
@ -18,15 +18,11 @@ const buildStylePresetsUrl = (path: string = '') => buildV1Url(`style_presets/${
|
|||||||
|
|
||||||
export const stylePresetsApi = api.injectEndpoints({
|
export const stylePresetsApi = api.injectEndpoints({
|
||||||
endpoints: (build) => ({
|
endpoints: (build) => ({
|
||||||
getStylePreset: build.query<
|
selectStylePreset: build.mutation<void, string>({
|
||||||
paths['/api/v1/style_presets/i/{style_preset_id}']['get']['responses']['200']['content']['application/json'],
|
query: (style_preset_id) => ({
|
||||||
string
|
url: buildStylePresetsUrl(`i/${style_preset_id}`),
|
||||||
>({
|
method: 'POST',
|
||||||
query: (style_preset_id) => buildStylePresetsUrl(`i/${style_preset_id}`),
|
}),
|
||||||
providesTags: (result, error, style_preset_id) => [
|
|
||||||
{ type: 'StylePreset', id: style_preset_id },
|
|
||||||
'FetchOnReconnect',
|
|
||||||
],
|
|
||||||
}),
|
}),
|
||||||
deleteStylePreset: build.mutation<void, string>({
|
deleteStylePreset: build.mutation<void, string>({
|
||||||
query: (style_preset_id) => ({
|
query: (style_preset_id) => ({
|
||||||
|
Loading…
x
Reference in New Issue
Block a user