Skip to content

Commit e2140fa

Browse files
committed
Update fetcher to include fetch options
1 parent 4a134c9 commit e2140fa

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

src/libs/fetch.js

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,17 @@
11
// @todo Add error handling - Ryan
22
export default async function fetcher(...args) {
3-
const res = await fetch(...args)
3+
const [url, options] = args
4+
5+
const fetchOptions = {
6+
credentials: 'include',
7+
headers: {
8+
'Content-Type': 'application/json',
9+
},
10+
mode: 'no-cors',
11+
...options,
12+
}
13+
14+
const res = await fetch(url, fetchOptions)
15+
416
return res.json()
517
}

0 commit comments

Comments
 (0)