feat : refacto de la partie calendrier + ajout de validation sur les formulaires + ajout des jours fériés
This commit is contained in:
18
frontend/services/public-holidays.ts
Normal file
18
frontend/services/public-holidays.ts
Normal file
@@ -0,0 +1,18 @@
|
||||
export type PublicHolidaysResponse =
|
||||
| { days?: Record<string, string> }
|
||||
| Record<string, string>
|
||||
|
||||
export const listPublicHolidays = async (zone: string, year: number) => {
|
||||
const api = useApi()
|
||||
const data = await api.get<PublicHolidaysResponse>(
|
||||
`/public-holidays/${zone}/${year}`,
|
||||
{},
|
||||
{ toast: false }
|
||||
)
|
||||
|
||||
if (data && typeof data === 'object' && 'days' in data) {
|
||||
return (data.days ?? {}) as Record<string, string>
|
||||
}
|
||||
|
||||
return (data ?? {}) as Record<string, string>
|
||||
}
|
||||
Reference in New Issue
Block a user