-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #12 from quran/dev
v1.7.0
- Loading branch information
Showing
17 changed files
with
294 additions
and
278 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,11 @@ | ||
{ | ||
"index": "Introduction", | ||
"techniques": "Techniques", | ||
"chapters": "Chapters", | ||
"verses": "Verses", | ||
"search": "Search", | ||
"juzs": "Juzs", | ||
"audio": "Audio", | ||
"resources": "Resources", | ||
"utils": "Utilities" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
## Custom fetcher | ||
|
||
By default, all functions that interact with the [Quran.com API](https://quran.api-docs.io/v4) use the global `fetch` function. | ||
|
||
You can override this by passing a custom fetcher (as `fetchFn`) to the options object of any method. | ||
|
||
import { Callout } from 'nextra-theme-docs'; | ||
|
||
<Callout> | ||
Note that the `fetchFn` accepts a string url and must return a promise with | ||
the JSON response. | ||
</Callout> | ||
|
||
### Examples | ||
|
||
#### Axios | ||
|
||
```ts | ||
import axios from 'axios'; | ||
|
||
const chapters = await quran.v4.chapters.findAll({ | ||
fetchFn: (url) => axios.get(url).then((res) => res.data), | ||
}); | ||
``` | ||
|
||
--- | ||
|
||
#### Node-fetch | ||
|
||
```ts | ||
import fetch from 'node-fetch'; | ||
|
||
const chapters = await quran.v4.chapters.findAll({ | ||
fetchFn: async (url) => { | ||
const response = await fetch(url); | ||
return response.json(); | ||
}, | ||
}); | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
201dc39
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
api – ./docs
quranjs.vercel.app
api-quranjs.vercel.app
api-git-master-quranjs.vercel.app
quranjs.com
www.quranjs.com