24 lines
570 B
TypeScript
24 lines
570 B
TypeScript
import type { AiImportResponse, AiExtractedCategory } from "@menulio/shared";
|
|
|
|
let currentImportData: AiImportResponse | null = null;
|
|
|
|
export const aiStore = {
|
|
setImportData: (data: AiImportResponse) => {
|
|
currentImportData = data;
|
|
},
|
|
getImportData: (): AiImportResponse | null => {
|
|
return currentImportData;
|
|
},
|
|
updateCategories: (categories: AiExtractedCategory[]) => {
|
|
if (currentImportData) {
|
|
currentImportData = {
|
|
...currentImportData,
|
|
categories,
|
|
};
|
|
}
|
|
},
|
|
clear: () => {
|
|
currentImportData = null;
|
|
},
|
|
};
|