import { VaccinationData , VaccinationDataRt } from './types' ; import fetch from 'isomorphic-unfetch' ; const SCHEDULE_ENDPOINT = `https://vaksin-jakarta.yggdrasil.id/` ; const getSchedule = async ( ) => { const payload = await fetch ( SCHEDULE_ENDPOINT ) ; const json = ( await payload . json ( ) ) as VaccinationData [ ] ; const validation = VaccinationDataRt . validate ( json ) ; if ( ! validation . success ) { console . error ( 'Contract Error: /n' , validation ) ; } return json ; } ; export { getSchedule } ;