diff --git a/apps/cs/src/shared/config/api.ts b/apps/cs/src/shared/config/api.ts
index 6ed82dec1..cb140e5ea 100644
--- a/apps/cs/src/shared/config/api.ts
+++ b/apps/cs/src/shared/config/api.ts
@@ -5,6 +5,7 @@ export const BASE_URL = `${PROXY_HOST}/server`;
export const ENDPOINT = {
ATTACH_SERVICE: {
TUS_UPLOAD: "/attach-service/api/v1/tus/upload",
+ EDITOR_UPLOAD: "/attach-service/api/v1/upload/editor",
IMAGES: "/attach-service/api/v1/images",
ATTACHMENTS: "/attach-service/api/v1/atfl/attachments",
},
diff --git a/apps/cs/src/shared/lib/use-attachment-store.ts b/apps/cs/src/shared/lib/use-attachment-store.ts
new file mode 100644
index 000000000..285699cc6
--- /dev/null
+++ b/apps/cs/src/shared/lib/use-attachment-store.ts
@@ -0,0 +1,14 @@
+import { useStore } from "zustand";
+import { useContext } from "react";
+import type { AttachmentStore } from "../store/attachment-store";
+import { StoreContext } from "../providers/store-provider";
+
+export const useAttachmentStore =
(
+ selector: (store: AttachmentStore) => T,
+): T => {
+ const store = useContext(StoreContext);
+ if (!store) {
+ throw new Error("useAttachmentStore must be used within StoreProvider");
+ }
+ return useStore(store.attachmentStore, selector);
+};
diff --git a/apps/cs/src/shared/providers/store-provider.tsx b/apps/cs/src/shared/providers/store-provider.tsx
index 82783bdac..a0ec17b61 100644
--- a/apps/cs/src/shared/providers/store-provider.tsx
+++ b/apps/cs/src/shared/providers/store-provider.tsx
@@ -1,10 +1,16 @@
"use client";
import { createContext, useRef } from "react";
-import { createAlertStore, createMenuStore, createUserStore } from "../store";
+import {
+ createAlertStore,
+ createAttachmentStore,
+ createMenuStore,
+ createUserStore,
+} from "../store";
type StoreContextType = {
alertStore: ReturnType;
+ attachmentStore: ReturnType;
menuStore: ReturnType;
userStore: ReturnType;
};
@@ -18,6 +24,7 @@ export const StoreProvider = ({ children }: { children: React.ReactNode }) => {
if (storeRef.current === null) {
storeRef.current = {
alertStore: createAlertStore(),
+ attachmentStore: createAttachmentStore(),
menuStore: createMenuStore(),
userStore: createUserStore(),
};
diff --git a/apps/cs/src/shared/store/attachment-store.ts b/apps/cs/src/shared/store/attachment-store.ts
new file mode 100644
index 000000000..faa700949
--- /dev/null
+++ b/apps/cs/src/shared/store/attachment-store.ts
@@ -0,0 +1,25 @@
+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()((set) => ({
+ ...initState,
+ setAttachmentFileCode: (attachmentFileCode: string) =>
+ set({ attachmentFileCode }),
+ }));
+};
diff --git a/apps/cs/src/shared/store/index.ts b/apps/cs/src/shared/store/index.ts
index 73c608f05..e26f6781e 100644
--- a/apps/cs/src/shared/store/index.ts
+++ b/apps/cs/src/shared/store/index.ts
@@ -1,3 +1,4 @@
export { createAlertStore } from "./alert-store";
+export { createAttachmentStore } from "./attachment-store";
export { createMenuStore } from "./menu-store";
export { createUserStore, type IUserInfo } from "./user-store";
diff --git a/apps/cs/src/shared/ui/editor.tsx b/apps/cs/src/shared/ui/editor.tsx
deleted file mode 100644
index 731b13f46..000000000
--- a/apps/cs/src/shared/ui/editor.tsx
+++ /dev/null
@@ -1,19 +0,0 @@
-import { Editor as TinyEditor } from "@tinymce/tinymce-react";
-
-const Editor = () => {
- return (
-
- );
-};
-
-export { Editor };