This commit is contained in:
n4ze3m
2024-08-26 14:13:00 +05:30
7 changed files with 33 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"

View File

@@ -4,6 +4,7 @@ import { useQuery } from "@tanstack/react-query"
import { Skeleton } from "antd"
import { cleanUrl } from "@/libs/clean-url"
import { Descriptions } from "antd"
import fetcher from "@/libs/fetcher"
export const AboutApp = () => {
const { t } = useTranslation("settings")
@@ -14,7 +15,7 @@ export const AboutApp = () => {
const chromeVersion = browser.runtime.getManifest().version
try {
const url = await getOllamaURL()
const req = await fetch(`${cleanUrl(url)}/api/version`)
const req = await fetcher(`${cleanUrl(url)}/api/version`)
if (!req.ok) {
return {

View File

@@ -7,6 +7,7 @@ import { deleteWebshare, getAllWebshares, getUserId } from "@/db"
import { getPageShareUrl, setPageShareUrl } from "~/services/ollama"
import { verifyPageShareURL } from "~/utils/verify-page-share"
import { useStorage } from "@plasmohq/storage/hook"
import fetcher from "@/libs/fetcher"
export const OptionShareBody = () => {
const queryClient = useQueryClient()
@@ -48,7 +49,7 @@ export const OptionShareBody = () => {
api_url: string
}) => {
const owner_id = await getUserId()
const res = await fetch(`${api_url}/api/v1/share/delete`, {
const res = await fetcher(`${api_url}/api/v1/share/delete`, {
method: "POST",
headers: {
"Content-Type": "application/json"