beuaah
This commit is contained in:
parent
414aec97e5
commit
0fb4513b4b
2 changed files with 7 additions and 7 deletions
|
|
@ -9,9 +9,9 @@ async function sendRequest(endpoint, body) {
|
|||
|
||||
const request = {
|
||||
method: "POST",
|
||||
headers: {
|
||||
"Content-Type": "application/x-www-form-urlencoded",
|
||||
},
|
||||
// headers: {
|
||||
// "Content-Type": "application/x-www-form-urlencoded",
|
||||
// },
|
||||
|
||||
body: formData,
|
||||
};
|
||||
|
|
@ -130,7 +130,6 @@ async function authenticate() {
|
|||
* body, rather than just the body
|
||||
*/
|
||||
async function authedAPIRequest(endpoint, options) {
|
||||
console.log("Attemtping to make a request to: " + endpoint); // TODO remove
|
||||
if (!authenticate()) {
|
||||
return null;
|
||||
}
|
||||
|
|
@ -146,10 +145,11 @@ async function authedAPIRequest(endpoint, options) {
|
|||
options.headers.Authorization = localStorage.getItem("token");
|
||||
options.mode = "cors";
|
||||
|
||||
const full_endpoint = import.meta.env.VITE_URL + endpoint;
|
||||
let response;
|
||||
|
||||
try {
|
||||
response = await fetch(endpoint, options);
|
||||
response = await fetch(full_endpoint, options);
|
||||
if (!response.ok) {
|
||||
throw new Error(response.statusText);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue