fix: fixed the incorrect parts

This commit is contained in:
이광오 2023-07-31 20:16:55 +09:00
parent d8bf7297fb
commit 605c5cb6eb
2 changed files with 3 additions and 4 deletions

View File

@ -2,7 +2,7 @@ import { createURL, fetchURL, removePrefix, removeTusEndpoint } from "./utils";
import { baseURL } from "@/utils/constants"; import { baseURL } from "@/utils/constants";
import store from "@/store"; import store from "@/store";
import { upload as postTus, useTus } from "./tus"; import { upload as postTus, useTus } from "./tus";
import {tusEndpoint} from "../utils/constants"; import { tusEndpoint } from "../utils/constants";
export async function fetch(url) { export async function fetch(url) {
url = removePrefix(url); url = removePrefix(url);
@ -90,7 +90,7 @@ export async function post(url, content = "", overwrite = false, onupload) {
// Tus is disabled / not applicable // Tus is disabled / not applicable
!(await useTus(content)); !(await useTus(content));
if (!useResourcesApi) { if (!useResourcesApi) {
url = removeTusEndpoint(tusEndpoint, url) url = removeTusEndpoint(tusEndpoint, url);
} }
return useResourcesApi return useResourcesApi
? postResources(url, content, overwrite, onupload) ? postResources(url, content, overwrite, onupload)

View File

@ -8,7 +8,6 @@ export async function fetchURL(url, opts, auth = true) {
opts.headers = opts.headers || {}; opts.headers = opts.headers || {};
let { headers, ...rest } = opts; let { headers, ...rest } = opts;
let res; let res;
try { try {
res = await fetch(`${baseURL}${url}`, { res = await fetch(`${baseURL}${url}`, {
@ -85,4 +84,4 @@ export function removeTusEndpoint(tusEndpoint, url) {
return url.substring(tusEndpoint.length); return url.substring(tusEndpoint.length);
} }
return url; return url;
} }