work on porting over contact form from old site, also added initial db support
to use later
This commit is contained in:
parent
8d989ef36f
commit
f641dac69b
12 changed files with 232 additions and 32 deletions
46
src/lib/HttpFetchClient.ts
Normal file
46
src/lib/HttpFetchClient.ts
Normal file
|
|
@ -0,0 +1,46 @@
|
|||
const httpFetchClient = {
|
||||
get: async (url: string, headers: Record<string, string>) => {
|
||||
const response = await fetch(url, {
|
||||
method: "GET",
|
||||
headers,
|
||||
});
|
||||
|
||||
return response.json();
|
||||
},
|
||||
post: async (url: string, body: JSON, headers: Record<string, string>) => {
|
||||
const response = await fetch(url, {
|
||||
method: "POST",
|
||||
headers,
|
||||
body: JSON.stringify(body),
|
||||
});
|
||||
|
||||
return response.json();
|
||||
},
|
||||
put: async (url: string, body: JSON, headers: Record<string, string>) => {
|
||||
const response = await fetch(url, {
|
||||
method: "PUT",
|
||||
headers,
|
||||
body: JSON.stringify(body),
|
||||
});
|
||||
|
||||
return response.json();
|
||||
},
|
||||
patch: async (url: string, body: JSON, headers: Record<string, string>) => {
|
||||
const response = await fetch(url, {
|
||||
method: "PATCH",
|
||||
headers,
|
||||
body: JSON.stringify(body),
|
||||
});
|
||||
|
||||
return response.json();
|
||||
},
|
||||
delete: async (url: string, headers: Record<string, string>) => {
|
||||
const response = await fetch(url, {
|
||||
method: "DELETE",
|
||||
headers,
|
||||
});
|
||||
|
||||
return response.json();
|
||||
},
|
||||
};
|
||||
export default httpFetchClient;
|
||||
Loading…
Add table
Add a link
Reference in a new issue