Skip to content

Commit

Permalink
Deleted getAsmaa API endpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
Ref-Bit authored Aug 18, 2022
1 parent 8ebb8ed commit 6933851
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 30 deletions.
40 changes: 15 additions & 25 deletions src/api/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ export const getCityCountry = async () => {
try {
const { data } = await axios.get(`https://api.ipbase.com/v2/info?apikey=${process.env.REACT_APP_IP_ACCESS_KEY}`)

if(data !== null || data.length !== 0){
return data
}else{
if (data !== null || data.length !== 0) {
return data
} else {
return []
}
} catch (error) {
Expand All @@ -24,9 +24,9 @@ export const getPrayerTimesCalendar = async (city, country, month, year) => {
try {
const { data: { data } } = await axios.get(changeURL);

if(data !== null || data.length !== 0){
return data
}else{
if (data !== null || data.length !== 0) {
return data
} else {
return []
}
} catch (error) {
Expand All @@ -40,9 +40,9 @@ export const getPrayerTimesCalendarDaily = async (city, country, method, lat, sc
try {
const { data: { data } } = await axios.get(changeURL);

if(data !== null || data.length !== 0){
return data
}else{
if (data !== null || data.length !== 0) {
return data
} else {
return []
}
} catch (error) {
Expand All @@ -53,17 +53,17 @@ export const getPrayerTimesCalendarDaily = async (city, country, method, lat, sc

export const getRandomAyah = async (random, identifier, language) => {
try {
if(language !=='ar'){
if (language !== 'ar') {
const { data } = await axios(`${apiAyahURL}ayah/${random}/${identifier}`)

return data
}else{
} else {
const { data } = await axios(`${apiAyahURL}ayah/${random}`)

return data
}
} catch (error) {
console.log(error)
console.log(error)
}
}

Expand All @@ -88,19 +88,9 @@ export const getAyahAudio = async (num, identifier) => {
}

export const getTranslations = async (locale) => {
try{
try {
const { data } = await axios(`${apiAyahURL}edition?format=text&language=${locale}&type=translation`)

return data
} catch (error) {
console.log(error)
}
}

export const getAsmaa = async () => {
try{
const { data } = await axios('../data/asmaa_al_husna.json')

return data
} catch (error) {
console.log(error)
Expand Down
6 changes: 1 addition & 5 deletions src/components/layout/Master.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import React, { useState, useEffect, useContext } from 'react';
import { useTranslation } from 'react-i18next';
import { getRandomAyah, getAyahReciters, getAyahAudio, getPrayerTimesCalendarDaily, getTranslations, getAsmaa } from '../../api';
import { muezzins, methods, latitudes, schools, midnight } from '../../data/data.json';
import asmaa from '../../data/asmaa_al_husna.json';
import { GlobalContext } from '../../context/Global';
import { Spinner } from '..';

Expand All @@ -15,7 +16,6 @@ export default () => {
const [ audio, setAudio ] = useState([])
const [ ayah, setAyah ] = useState([])
const [ translations, setTranslations ] = useState([])
const [ asmaa, setAsmaa ] = useState([])
const [ calender, setCalender ] = useState([])
const [ muezzin, setMuezzin ] = useState('')
const [ method, setMethod ] = useState(3)
Expand All @@ -37,10 +37,6 @@ export default () => {
setTranslations(data)
}).catch( err => console.log(err) )

getAsmaa().then(({data}) => {
setAsmaa(data)
}).catch( err => console.log(err) )

getPrayerTimesCalendarDaily(city, country, method, lat, school, midnightMode).then((data) => {
setCalender(data)
}).catch( err => console.log(err) )
Expand Down

0 comments on commit 6933851

Please sign in to comment.