Skip to content

Commit

Permalink
fix: set content type on all requests to backend
Browse files Browse the repository at this point in the history
  • Loading branch information
asaf committed Aug 6, 2024
1 parent b70c9d4 commit 80cf2ae
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/lib/backend.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ export async function listFetcher<T>(
const response = await fetcher<FetchResponse<T>>(url, {
...init,
headers: {
'Content-Type': 'application/json',
Authorization: `Bearer ${session?.accessToken}`
}
});
Expand Down Expand Up @@ -124,6 +125,7 @@ export async function getFetcher<JSON = any>(
const result = await fetcher<JSON>(info, {
...init,
headers: {
'Content-Type': 'application/json',
Authorization: `Bearer ${session?.accessToken}`
}
});
Expand Down Expand Up @@ -179,6 +181,7 @@ export async function deleteFetcher(
...init,
method: 'DELETE',
headers: {
'Content-Type': 'application/json',
Authorization: `Bearer ${session?.accessToken}`
}
});
Expand Down Expand Up @@ -222,6 +225,7 @@ export async function getConversation(
`/conversations/${id}?id_type=internal&links=messages`,
{
headers: {
'Content-Type': 'application/json',
Authorization: `Bearer ${config.accessToken}`
}
}
Expand All @@ -245,6 +249,7 @@ export async function createConversation(
const resp = fetcher<Conversation>('/conversations', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
Authorization: `Bearer ${config.accessToken}`
},
body: JSON.stringify(conversation)
Expand All @@ -265,6 +270,7 @@ export async function listConversations(
{
next: { tags: ['conversations'] },
headers: {
'Content-Type': 'application/json',
Authorization: `Bearer ${session?.accessToken}`
}
}
Expand Down

0 comments on commit 80cf2ae

Please sign in to comment.