fix: setting entities to done

This commit is contained in:
2025-10-05 15:20:35 +01:00
parent 838ab37fc1
commit bd86ad499b
4 changed files with 40 additions and 3 deletions

View File

@@ -10,6 +10,7 @@ import {
import {
deleteImage,
deleteImageFromStack,
deleteStack,
deleteStackItem,
getUserImages,
JustTheImageWhatAreTheseNames,
@@ -25,8 +26,11 @@ export type SearchImageStore = {
userImages: Accessor<JustTheImageWhatAreTheseNames>;
onRefetchImages: () => void;
onDeleteImage: (imageID: string) => void;
onDeleteImageFromStack: (stackID: string, imageID: string) => void;
onDeleteStack: (stackID: string) => void;
onDeleteStackItem: (stackID: string, schemaItemID: string) => void;
};
@@ -76,6 +80,9 @@ export const SearchImageContextProvider: Component<ParentProps> = (props) => {
onDeleteImageFromStack: (stackID: string, imageID: string) => {
deleteImageFromStack(stackID, imageID).then(refetch);
},
onDeleteStack: (stackID: string) => {
deleteStack(stackID).then(refetch)
},
onDeleteStackItem: (stackID: string, schemaItemID: string) => {
deleteStackItem(stackID, schemaItemID).then(refetch);
},

View File

@@ -8,7 +8,7 @@ import {
createResource,
createSignal,
} from "solid-js";
import { base, deleteStack, getAccessToken } from "../../network";
import { base, getAccessToken } from "../../network";
import { Dialog } from "@kobalte/core";
const DeleteButton: Component<{ onDelete: () => void }> = (props) => {
@@ -107,14 +107,14 @@ export const Stack: Component = () => {
const { stackID } = useParams();
const nav = useNavigate();
const { stacks, onDeleteImageFromStack } = useSearchImageContext();
const { stacks, onDeleteImageFromStack, onDeleteStack } = useSearchImageContext();
const [accessToken] = createResource(getAccessToken);
const stack = () => stacks().find((l) => l.ID === stackID);
const handleDeleteStack = async () => {
await deleteStack(stackID)
onDeleteStack(stackID);
nav("/");
};