Skip to content

Commit bd3c194

Browse files
authored
fix: revert fetchURL changes in auth (Fixes filebrowser#2729) (filebrowser#2739)
1 parent 01f7842 commit bd3c194

File tree

1 file changed

+14
-22
lines changed

1 file changed

+14
-22
lines changed

frontend/src/utils/auth.js

+14-22
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import store from "@/store";
22
import router from "@/router";
33
import { Base64 } from "js-base64";
4-
import { fetchURL } from "@/api/utils";
4+
import { baseURL } from "@/utils/constants";
55

66
export function parseToken(token) {
77
const parts = token.split(".");
@@ -32,17 +32,13 @@ export async function validateLogin() {
3232
export async function login(username, password, recaptcha) {
3333
const data = { username, password, recaptcha };
3434

35-
const res = await fetchURL(
36-
`/api/login`,
37-
{
38-
method: "POST",
39-
headers: {
40-
"Content-Type": "application/json",
41-
},
42-
body: JSON.stringify(data),
35+
const res = await fetch(`${baseURL}/api/login`, {
36+
method: "POST",
37+
headers: {
38+
"Content-Type": "application/json",
4339
},
44-
false
45-
);
40+
body: JSON.stringify(data),
41+
});
4642

4743
const body = await res.text();
4844

@@ -54,7 +50,7 @@ export async function login(username, password, recaptcha) {
5450
}
5551

5652
export async function renew(jwt) {
57-
const res = await fetchURL(`/api/renew`, {
53+
const res = await fetch(`${baseURL}/api/renew`, {
5854
method: "POST",
5955
headers: {
6056
"X-Auth": jwt,
@@ -73,17 +69,13 @@ export async function renew(jwt) {
7369
export async function signup(username, password) {
7470
const data = { username, password };
7571

76-
const res = await fetchURL(
77-
`/api/signup`,
78-
{
79-
method: "POST",
80-
headers: {
81-
"Content-Type": "application/json",
82-
},
83-
body: JSON.stringify(data),
72+
const res = await fetch(`${baseURL}/api/signup`, {
73+
method: "POST",
74+
headers: {
75+
"Content-Type": "application/json",
8476
},
85-
false
86-
);
77+
body: JSON.stringify(data),
78+
});
8779

8880
if (res.status !== 200) {
8981
throw new Error(res.status);

0 commit comments

Comments
 (0)