feat : update announcement
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
import { ICreateData } from "./type_announcement";
|
||||
|
||||
export const funGetAllAnnouncement = async (path?: string) => {
|
||||
const response = await fetch(`/api/announcement${(path) ? path : ''}`, { next: { tags: ['announcement'] } });
|
||||
return await response.json().catch(() => null);
|
||||
@@ -6,4 +8,15 @@ export const funGetAllAnnouncement = async (path?: string) => {
|
||||
export const funGetAnnouncementById = async (path: string) => {
|
||||
const response = await fetch(`/api/announcement/${path}`);
|
||||
return await response.json().catch(() => null);
|
||||
}
|
||||
|
||||
export const funCreateAnnouncement = async (data: ICreateData) => {
|
||||
const response = await fetch("/api/announcement", {
|
||||
method: "POST",
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
},
|
||||
body: JSON.stringify(data),
|
||||
});
|
||||
return await response.json().catch(() => null);
|
||||
}
|
||||
@@ -1,33 +1,46 @@
|
||||
export interface IListDataAnnouncement {
|
||||
id: string,
|
||||
title: string,
|
||||
desc: string,
|
||||
createdAt: string
|
||||
id: string,
|
||||
title: string,
|
||||
desc: string,
|
||||
createdAt: string
|
||||
}
|
||||
|
||||
export interface IRootAllAnnouncement {
|
||||
announcement: IAnnouncement
|
||||
allAnnouncementMember: IAllAnnouncementMember[]
|
||||
}
|
||||
|
||||
export interface IAnnouncement {
|
||||
id: string
|
||||
title: string
|
||||
desc: string
|
||||
}
|
||||
|
||||
export interface IAllAnnouncementMember {
|
||||
idAnnouncement: string
|
||||
idGroup: string
|
||||
idDivision: string
|
||||
group: string
|
||||
}
|
||||
announcement: IAnnouncement
|
||||
allAnnouncementMember: IAllAnnouncementMember[]
|
||||
}
|
||||
|
||||
export interface GroupData {
|
||||
export interface IAnnouncement {
|
||||
id: string
|
||||
title: string
|
||||
desc: string
|
||||
}
|
||||
|
||||
export interface IAllAnnouncementMember {
|
||||
idAnnouncement: string
|
||||
idGroup: string
|
||||
idDivision: string
|
||||
group: string
|
||||
}
|
||||
|
||||
export interface GroupData {
|
||||
id: string;
|
||||
name: string;
|
||||
Division: {
|
||||
id: string;
|
||||
name: string;
|
||||
id: string;
|
||||
name: string;
|
||||
}[];
|
||||
}
|
||||
}
|
||||
|
||||
export interface ICreateData {
|
||||
title: string
|
||||
desc: string
|
||||
|
||||
}
|
||||
|
||||
export interface IGroupData {
|
||||
idAnnouncement: string
|
||||
idGroup: string
|
||||
idDivision: string
|
||||
isActive: boolean
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user