headers-api-everywhere: Add headers to all api calls

This commit is contained in:
Colin Campbell
2024-08-22 10:12:03 +02:00
parent 95a4d9f357
commit ca2c127cbd
6 changed files with 19 additions and 13 deletions

View File

@@ -9,6 +9,7 @@ import { getPageShareUrl } from "~/services/ollama"
import { cleanUrl } from "~/libs/clean-url"
import { getUserId, saveWebshare } from "@/db"
import { useTranslation } from "react-i18next"
import fetcher from "@/libs/fetcher"
type Props = {
messages: Message[]
@@ -94,7 +95,7 @@ export const ShareBtn: React.FC<Props> = ({ messages }) => {
const chat = reformatMessages(messages, values.name)
const title = values.title
const url = await getPageShareUrl()
const res = await fetch(`${cleanUrl(url)}/api/v1/share/create`, {
const res = await fetcher(`${cleanUrl(url)}/api/v1/share/create`, {
method: "POST",
headers: {
"Content-Type": "application/json"