mirror of
https://github.com/invoke-ai/InvokeAI
synced 2024-08-30 20:32:17 +00:00
17 lines
652 B
TypeScript
17 lines
652 B
TypeScript
import { ASSETS_CATEGORIES, IMAGE_CATEGORIES } from 'features/gallery/store/types';
|
|
import queryString from 'query-string';
|
|
import { buildV1Url } from 'services/api';
|
|
|
|
import type { ImageDTO, ListImagesArgs } from './types';
|
|
|
|
export const getCategories = (imageDTO: ImageDTO) => {
|
|
if (IMAGE_CATEGORIES.includes(imageDTO.image_category)) {
|
|
return IMAGE_CATEGORIES;
|
|
}
|
|
return ASSETS_CATEGORIES;
|
|
};
|
|
|
|
// Helper to create the url for the listImages endpoint. Also we use it to create the cache key.
|
|
export const getListImagesUrl = (queryArgs: ListImagesArgs) =>
|
|
buildV1Url(`images/?${queryString.stringify(queryArgs, { arrayFormat: 'none' })}`);
|