headers-api-everywhere: Add headers to all api calls
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import { setBadgeBackgroundColor, setBadgeText, setTitle } from "@/utils/action"
|
||||
|
||||
import fetcher from "@/libs/fetcher"
|
||||
|
||||
export const progressHuman = (completed: number, total: number) => {
|
||||
return ((completed / total) * 100).toFixed(0) + "%"
|
||||
@@ -11,7 +11,7 @@ export const clearBadge = () => {
|
||||
}
|
||||
export const streamDownload = async (url: string, model: string) => {
|
||||
url += "/api/pull"
|
||||
const response = await fetch(url, {
|
||||
const response = await fetcher(url, {
|
||||
method: "POST",
|
||||
headers: {
|
||||
"Content-Type": "application/json"
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
import { cleanUrl } from "~/libs/clean-url"
|
||||
import fetcher from "@/libs/fetcher"
|
||||
|
||||
export const verifyPageShareURL = async (url: string) => {
|
||||
const res = await fetch(`${cleanUrl(url)}/api/v1/ping`)
|
||||
const res = await fetcher(`${cleanUrl(url)}/api/v1/ping`)
|
||||
if (!res.ok) {
|
||||
throw new Error("Unable to verify page share")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user