Skip to content

Commit 08e3181

Browse files
committed
Add base options for fetching
1 parent 1eb0ef4 commit 08e3181

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

client/src/hooks/useFetch.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,11 +42,18 @@ const useFetch = (route, onReceived) => {
4242
setError(null);
4343
setIsLoading(true);
4444

45+
const baseOptions = {
46+
method: "GET",
47+
headers: {
48+
"content-type": "application/json",
49+
},
50+
};
51+
4552
const fetchData = async () => {
4653
// We add the /api subsection here to make it a single point of change if our configuration changes
4754
const url = `${process.env.BASE_SERVER_URL}/api${route}`;
4855

49-
const res = await fetch(url, { ...options, signal });
56+
const res = await fetch(url, { ...baseOptions, ...options, signal });
5057

5158
if (!res.ok) {
5259
setError(

0 commit comments

Comments
 (0)