feat : update add calender
This commit is contained in:
@@ -1,10 +1,29 @@
|
||||
import { IFormCreateCalender } from "./type_calender";
|
||||
|
||||
export const funGetAllCalender = async (path?: string) => {
|
||||
const response = await fetch(`/api/calender${(path) ? path : ''}`, { next: { tags: ['calender'] } });
|
||||
return await response.json().catch(() => null);
|
||||
}
|
||||
|
||||
|
||||
export const funGetOneCalender = async (path: string) => {
|
||||
const response = await fetch(`/api/calender/${path}`);
|
||||
return await response.json().catch(() => null);
|
||||
}
|
||||
|
||||
export const funCreateCalender = async (data: IFormCreateCalender) => {
|
||||
const response = await fetch("/api/calender", {
|
||||
method: "POST",
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
},
|
||||
body: JSON.stringify(data),
|
||||
});
|
||||
return await response.json().catch(() => null);
|
||||
}
|
||||
|
||||
export const funDeleteCalenderById = async (path: string) => {
|
||||
const response = await fetch(`/api/calender/${path}`, {
|
||||
method: "DELETE",
|
||||
});
|
||||
return await response.json().catch(() => null);
|
||||
}
|
||||
@@ -27,4 +27,24 @@ export interface IDataDetailByIdMember {
|
||||
idUser: string
|
||||
name: string
|
||||
email: string
|
||||
}
|
||||
|
||||
export interface IFormCreateCalender {
|
||||
idDivision: string
|
||||
title: string
|
||||
dateStart: String
|
||||
timeStart: string
|
||||
timeEnd: string
|
||||
linkMeet: string
|
||||
repeatEventTyper: string
|
||||
desc: string,
|
||||
member: IFormMemberCalender[]
|
||||
}
|
||||
|
||||
export interface IFormMemberCalender {
|
||||
idCalender: string
|
||||
idUser: {
|
||||
id: string
|
||||
name: string
|
||||
}[]
|
||||
}
|
||||
5
src/module/calender/lib/val_calender.ts
Normal file
5
src/module/calender/lib/val_calender.ts
Normal file
@@ -0,0 +1,5 @@
|
||||
import { hookstate } from "@hookstate/core";
|
||||
import { IFormMemberCalender } from "./type_calender";
|
||||
|
||||
|
||||
export const globalCalender = hookstate<IFormMemberCalender[]>([])
|
||||
Reference in New Issue
Block a user