rename: WithModePost -> PostPayloadData
This commit is contained in:
@@ -5,7 +5,7 @@ import type {
|
||||
PostService,
|
||||
PostingParams,
|
||||
Post,
|
||||
WithModePost,
|
||||
PostPayloadData,
|
||||
} from "../model/posting-interface";
|
||||
|
||||
export class PostingApiService implements PostService {
|
||||
@@ -19,7 +19,7 @@ export class PostingApiService implements PostService {
|
||||
return response.data;
|
||||
}
|
||||
|
||||
public async savePosting(data: WithModePost[]): Promise<Post[]> {
|
||||
public async savePosting(data: PostPayloadData[]): Promise<Post[]> {
|
||||
const response = await client.post<Post[]>(
|
||||
`${ENDPOINT.CMS_SERVICE.POSTINGS}`,
|
||||
data,
|
||||
|
||||
@@ -2,6 +2,6 @@ export { PostingApi } from "./api/posting-service";
|
||||
export {
|
||||
POSTING_TYPE,
|
||||
type Post,
|
||||
type WithModePost,
|
||||
type PostPayloadData,
|
||||
} from "./model/posting-interface";
|
||||
export { PostingDialog } from "./ui/posting-dialog";
|
||||
|
||||
@@ -26,7 +26,7 @@ export const postSchema = z.object({
|
||||
delYn: z.string(),
|
||||
});
|
||||
|
||||
export const withModePostSchema = postSchema
|
||||
export const postPayloadSchema = postSchema
|
||||
.extend({
|
||||
mode: z.string(),
|
||||
})
|
||||
@@ -37,14 +37,14 @@ export const withModePostSchema = postSchema
|
||||
});
|
||||
|
||||
export const postingFormSchema = z.object({
|
||||
pstg: z.array(withModePostSchema),
|
||||
pstg: z.array(postPayloadSchema),
|
||||
});
|
||||
|
||||
export type Post = z.infer<typeof postSchema>;
|
||||
export type WithModePost = z.infer<typeof withModePostSchema>;
|
||||
export type PostPayloadData = z.infer<typeof postPayloadSchema>;
|
||||
export type PostingFormData = z.infer<typeof postingFormSchema>;
|
||||
|
||||
export interface PostService {
|
||||
getPostingHistory: (params: PostingParams) => Promise<PageableList<Post>>;
|
||||
savePosting: (data: WithModePost[]) => Promise<Post[]>;
|
||||
savePosting: (data: PostPayloadData[]) => Promise<Post[]>;
|
||||
}
|
||||
|
||||
@@ -34,7 +34,7 @@ import {
|
||||
postingFormSchema,
|
||||
type PostingFormData,
|
||||
type PostingType,
|
||||
type WithModePost,
|
||||
type PostPayloadData,
|
||||
} from "../model/posting-interface";
|
||||
import { useAlertStore } from "@/shared/lib/use-alert-store";
|
||||
|
||||
@@ -76,7 +76,7 @@ function PostingDialog({ postingType, postingTargets }: PostingDialogProps) {
|
||||
});
|
||||
|
||||
const { mutateAsync: savePosting } = useMutation({
|
||||
mutationFn: (data: WithModePost[]) => PostingApi.savePosting(data),
|
||||
mutationFn: (data: PostPayloadData[]) => PostingApi.savePosting(data),
|
||||
onSuccess: () => {
|
||||
alert("저장되었습니다.");
|
||||
},
|
||||
|
||||
@@ -12,7 +12,7 @@ import {
|
||||
} from "@tanstack/react-table";
|
||||
import { useConfirm } from "@frontend-opensource/use-react-hooks";
|
||||
import { Button, DataTable } from "@common/components/ui";
|
||||
import { PostingApi, type WithModePost } from "@/entities/posting";
|
||||
import { PostingApi, type PostPayloadData } from "@/entities/posting";
|
||||
import { useAlertStore } from "@/shared/lib/use-alert-store";
|
||||
import { ConfirmDialog } from "@/shared/ui/confirm-dialog";
|
||||
import { ENDPOINT } from "@/shared/config";
|
||||
@@ -60,7 +60,7 @@ function ModifyPage({ sequential }: { sequential: string }) {
|
||||
});
|
||||
|
||||
const { mutateAsync: savePosting } = useMutation({
|
||||
mutationFn: (data: WithModePost[]) => PostingApi.savePosting(data),
|
||||
mutationFn: (data: PostPayloadData[]) => PostingApi.savePosting(data),
|
||||
onSuccess: () => {
|
||||
queryClient.invalidateQueries({
|
||||
queryKey: [ENDPOINT.CMS_SERVICE.POSTINGS, sequential],
|
||||
|
||||
@@ -12,7 +12,7 @@ import {
|
||||
} from "@tanstack/react-table";
|
||||
import { useConfirm } from "@frontend-opensource/use-react-hooks";
|
||||
import { Button, DataTable } from "@common/components/ui";
|
||||
import { PostingApi, type WithModePost } from "@/entities/posting";
|
||||
import { PostingApi, type PostPayloadData } from "@/entities/posting";
|
||||
import { useAlertStore } from "@/shared/lib/use-alert-store";
|
||||
import { ConfirmDialog } from "@/shared/ui/confirm-dialog";
|
||||
import { ENDPOINT } from "@/shared/config";
|
||||
@@ -56,7 +56,7 @@ function ModifyPage({ sequential }: { sequential: string }) {
|
||||
});
|
||||
|
||||
const { mutateAsync: savePosting } = useMutation({
|
||||
mutationFn: (data: WithModePost[]) => PostingApi.savePosting(data),
|
||||
mutationFn: (data: PostPayloadData[]) => PostingApi.savePosting(data),
|
||||
onSuccess: () => {
|
||||
queryClient.invalidateQueries({
|
||||
queryKey: [ENDPOINT.CMS_SERVICE.POSTINGS, sequential],
|
||||
|
||||
Reference in New Issue
Block a user