Fix all fetch requests v0.0.12
This commit is contained in:
parent
551f287b0a
commit
126830437d
@ -54,7 +54,7 @@ const registerUser = (name, username, email, password, verifyPassword) => {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
const res = fetch(`${url}/user/create/`, {
|
const res = fetch(`${url}/user/create`, {
|
||||||
method: "POST",
|
method: "POST",
|
||||||
body: JSON.stringify({
|
body: JSON.stringify({
|
||||||
name: name,
|
name: name,
|
||||||
@ -74,7 +74,7 @@ const getUserToken = async () => {
|
|||||||
const form = document.getElementById("register-form");
|
const form = document.getElementById("register-form");
|
||||||
const formData = new FormData(form);
|
const formData = new FormData(form);
|
||||||
|
|
||||||
const res = fetch(`${url}/token/`, {
|
const res = fetch(`${url}/token`, {
|
||||||
method: "POST",
|
method: "POST",
|
||||||
body: formData,
|
body: formData,
|
||||||
});
|
});
|
||||||
|
@ -21,7 +21,7 @@ const setTooltip = (type, message) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const signIn = async (username, password) => {
|
const signIn = async (username, password) => {
|
||||||
const res = fetch(`${url}/user/login/`, {
|
const res = fetch(`${url}/user/login`, {
|
||||||
method: "POST",
|
method: "POST",
|
||||||
body: JSON.stringify({
|
body: JSON.stringify({
|
||||||
username: username,
|
username: username,
|
||||||
@ -66,7 +66,7 @@ const getUserToken = async () => {
|
|||||||
const form = document.getElementById("sign-in-form");
|
const form = document.getElementById("sign-in-form");
|
||||||
const formData = new FormData(form);
|
const formData = new FormData(form);
|
||||||
|
|
||||||
const res = fetch(`${url}/token/`, {
|
const res = fetch(`${url}/token`, {
|
||||||
method: "POST",
|
method: "POST",
|
||||||
body: formData,
|
body: formData,
|
||||||
});
|
});
|
||||||
|
@ -73,7 +73,7 @@ const loadUserTasks = () => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const getUserTasks = (userToken) => {
|
const getUserTasks = (userToken) => {
|
||||||
const res = fetch(`${url}/users/me/`, {
|
const res = fetch(`${url}/users/me`, {
|
||||||
headers: {Authorization: `Bearer ${userToken}`}
|
headers: {Authorization: `Bearer ${userToken}`}
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -110,7 +110,7 @@ const updateTask = (userToken, taskTitle, taskDescription, completedStatus) => {
|
|||||||
"is_completed": completedStatus
|
"is_completed": completedStatus
|
||||||
});
|
});
|
||||||
|
|
||||||
const res = fetch(`${localhostUrl}/user/update-tasks/`, {
|
const res = fetch(`${localhostUrl}/user/update-tasks`, {
|
||||||
method: "PATCH",
|
method: "PATCH",
|
||||||
headers: {Authorization: `Bearer ${userToken}`, "Content-type": "application/json"},
|
headers: {Authorization: `Bearer ${userToken}`, "Content-type": "application/json"},
|
||||||
body: body
|
body: body
|
||||||
|
Loading…
Reference in New Issue
Block a user