UNPKG

salat

Version:

Daily Moroccan prayers time, right in your console, at the tip of your fingers

13 lines (12 loc) 425 B
import { PRIERE_API_URL } from "#services/constants"; export const getData = async (cityId, date = new Date()) => { const day = date.getDate(); const month = date.getMonth() + 1; const url = PRIERE_API_URL(cityId, day, month); const response = await fetch(url); const data = (await response.json()); if (!data.length) { throw new Error("No prayer data returned"); } return data[0]; };