Skip to content

Commit

Permalink
changes api
Browse files Browse the repository at this point in the history
  • Loading branch information
Cristina-Garcia committed Nov 6, 2023
1 parent 70957f6 commit 6b8dc0d
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 68 deletions.
62 changes: 21 additions & 41 deletions src/service/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,60 +15,40 @@ const options = {
//get books

async function getBooks() {
try {
const response = await axios.get(`${URL}/books`, options)
const data = response.data.data
return data
} catch (error) {
console.error(error)
}
const response = await axios.get(`${URL}/books`, options)
const data = response.data.data
return data
}
// get Chapters
const getChapters = async (bibleBookID) => {
try {
const response = await axios.get(
`${URL}/books/${bibleBookID}/chapters`,
options
)
return response.data.data
} catch (error) {
console.error(error)
}
const response = await axios.get(
`${URL}/books/${bibleBookID}/chapters`,
options
)
return response.data.data
}
//getPassages
const getPassages = async (passageId) => {
try {
const response = await axios.get(`${URL}/passages/${passageId}`, options)
return response.data.data
} catch (error) {
console.error(error)
}
const response = await axios.get(`${URL}/passages/${passageId}`, options)
return response.data.data
}
// get verses
const getVerses = async (chapterId) => {
try {
const response = await axios.get(
`${URL}/chapters/${chapterId}/verses`,
options
)
return response.data
} catch (error) {
console.error(error)
}
const response = await axios.get(
`${URL}/chapters/${chapterId}/verses`,
options
)
return response.data
}

// get a search
const searching = async (query) => {
try {
const response = await axios.get(
`${URL}/search?query=${query}&offset=1&sort=relevance`,
options
)
const result = response.data.data.verses
return result
} catch (error) {
console.error(error)
}
const response = await axios.get(
`${URL}/search?query=${query}&offset=1&sort=relevance`,
options
)
const result = response.data.data.verses
return result
}

const query = 'amor'
Expand Down
27 changes: 0 additions & 27 deletions src/service/index.js

This file was deleted.

0 comments on commit 6b8dc0d

Please sign in to comment.