26 lines
633 B
TypeScript
26 lines
633 B
TypeScript
import { createStore } from "zustand/vanilla";
|
|
|
|
export type AttachmentState = {
|
|
attachmentFileCode: string;
|
|
};
|
|
|
|
export type AttachmentActions = {
|
|
setAttachmentFileCode: (attachmentFileCode: string) => void;
|
|
};
|
|
|
|
export type AttachmentStore = AttachmentState & AttachmentActions;
|
|
|
|
export const defaultInitState: AttachmentState = {
|
|
attachmentFileCode: "",
|
|
};
|
|
|
|
export const createAttachmentStore = (
|
|
initState: AttachmentState = defaultInitState,
|
|
) => {
|
|
return createStore<AttachmentStore>()((set) => ({
|
|
...initState,
|
|
setAttachmentFileCode: (attachmentFileCode: string) =>
|
|
set({ attachmentFileCode }),
|
|
}));
|
|
};
|