260617_01_ENH: 배정 테스트를 위해 개발 중도 커밋
This commit is contained in:
35
src/query/notification.ts
Normal file
35
src/query/notification.ts
Normal file
@@ -0,0 +1,35 @@
|
||||
"use client";
|
||||
|
||||
import {useMutation, useQuery} from "@tanstack/react-query";
|
||||
import {nextApi} from "@/lib/http-client";
|
||||
import {BulkSendResponse, SaveTemplateRequest, SendSmsBulkRequest, Template} from "@/types/notification";
|
||||
|
||||
export const SMS_TEMPLATE_IDS = {
|
||||
ACCOUNT_MONITORING: 45,
|
||||
ASSIGN_CONFIRM: 46,
|
||||
CUSTOM: 47,
|
||||
} as const;
|
||||
|
||||
export const NOTIFICATION_REQUEST_SERVICE = "gwcf-review";
|
||||
|
||||
export function useNotificationTemplateQuery(templateIdx: number, enabled = true) {
|
||||
return useQuery({
|
||||
queryKey: ["notification", "template", templateIdx],
|
||||
queryFn: () => nextApi.get<Template>(`/notification/template/${templateIdx}`),
|
||||
enabled: enabled && templateIdx > 0,
|
||||
});
|
||||
}
|
||||
|
||||
export function useSaveNotificationTemplateMutation() {
|
||||
return useMutation({
|
||||
mutationFn: (data: SaveTemplateRequest) =>
|
||||
nextApi.patch<Template>("/notification/template", data),
|
||||
});
|
||||
}
|
||||
|
||||
export function useSendSmsBulkMutation() {
|
||||
return useMutation({
|
||||
mutationFn: (data: SendSmsBulkRequest) =>
|
||||
nextApi.post<BulkSendResponse>("/notification/sms-bulk", data),
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user