We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 1eb0ef4 commit 08e3181Copy full SHA for 08e3181
client/src/hooks/useFetch.js
@@ -42,11 +42,18 @@ const useFetch = (route, onReceived) => {
42
setError(null);
43
setIsLoading(true);
44
45
+ const baseOptions = {
46
+ method: "GET",
47
+ headers: {
48
+ "content-type": "application/json",
49
+ },
50
+ };
51
+
52
const fetchData = async () => {
53
// We add the /api subsection here to make it a single point of change if our configuration changes
54
const url = `${process.env.BASE_SERVER_URL}/api${route}`;
55
- const res = await fetch(url, { ...options, signal });
56
+ const res = await fetch(url, { ...baseOptions, ...options, signal });
57
58
if (!res.ok) {
59
setError(
0 commit comments