fix tsc errors

This commit is contained in:
Mary Hipp 2024-06-26 14:38:29 -04:00 committed by psychedelicious
parent a7ea096b28
commit 8fce168dc5
2 changed files with 7 additions and 3 deletions

View File

@ -11,6 +11,7 @@ import {
ipaLayerImageChanged,
rgLayerIPAdapterImageChanged,
} from 'features/controlLayers/store/controlLayersSlice';
import { selectListBoardsQueryArgs } from 'features/gallery/store/gallerySelectors';
import { fieldImageValueChanged } from 'features/nodes/store/nodesSlice';
import { selectOptimalDimension } from 'features/parameters/store/generationSlice';
import { toast } from 'features/toast/toast';
@ -62,7 +63,8 @@ export const addImageUploadedFulfilledListener = (startAppListening: AppStartLis
);
// Attempt to get the board's name for the toast
const { data } = boardsApi.endpoints.listAllBoards.select()(state);
const queryArgs = selectListBoardsQueryArgs(state);
const { data } = boardsApi.endpoints.listAllBoards.select(queryArgs)(state);
// Fall back to just the board id if we can't find the board for some reason
const board = data?.find((b) => b.board_id === autoAddBoardId);

View File

@ -1,4 +1,5 @@
import { getStore } from 'app/store/nanostores/store';
import { selectListBoardsQueryArgs } from 'features/gallery/store/gallerySelectors';
import { boardsApi } from 'services/api/endpoints/boards';
import { imagesApi } from 'services/api/endpoints/images';
import { modelsApi } from 'services/api/endpoints/models';
@ -43,9 +44,10 @@ export const checkImageAccess = async (name: string): Promise<boolean> => {
* @returns A promise that resolves to true if the client has access, else false.
*/
export const checkBoardAccess = async (id: string): Promise<boolean> => {
const { dispatch } = getStore();
const { dispatch, getState } = getStore();
try {
const req = dispatch(boardsApi.endpoints.listAllBoards.initiate());
const queryArgs = selectListBoardsQueryArgs(getState());
const req = dispatch(boardsApi.endpoints.listAllBoards.initiate(queryArgs));
req.unsubscribe();
const result = await req.unwrap();
return result.some((b) => b.board_id === id);