Removed api url
This commit is contained in:
parent
b3adc7c7dd
commit
ddac236778
4 changed files with 13 additions and 10 deletions
5
login.js
5
login.js
|
@ -1,8 +1,6 @@
|
||||||
let uname = document.querySelector('#uname').value; // grabbing the username submitted and putting it in the variable uname
|
let uname = document.querySelector('#uname').value; // grabbing the username submitted and putting it in the variable uname
|
||||||
let pin = document.querySelector('#pin').value; // grabbing the pin submitted and putting it in the variable pin
|
let pin = document.querySelector('#pin').value; // grabbing the pin submitted and putting it in the variable pin
|
||||||
const form = document.querySelector('form'); // grabbing an element on the page
|
const form = document.querySelector('form'); // grabbing an element on the page
|
||||||
const API_URL = `http://127.0.0.1:8000`
|
|
||||||
|
|
||||||
|
|
||||||
form.addEventListener("submit", async function(event) {
|
form.addEventListener("submit", async function(event) {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
|
@ -25,7 +23,8 @@ form.addEventListener("submit", async function(event) {
|
||||||
})
|
})
|
||||||
|
|
||||||
async function loginFetch() {
|
async function loginFetch() {
|
||||||
const rawResponse = await fetch(`${API_URL}/api/users/${uname}/${pin}`, {
|
const rawResponse = await fetch(`/api/users/${uname}/${pin}`, {
|
||||||
|
// credentials: "include",
|
||||||
method: 'GET',
|
method: 'GET',
|
||||||
headers: {
|
headers: {
|
||||||
'Accept': 'text/plain'
|
'Accept': 'text/plain'
|
||||||
|
|
|
@ -7,7 +7,6 @@ let newPin = document.querySelector('#newpin').value;
|
||||||
// let pronouns = ''
|
// let pronouns = ''
|
||||||
let responseText;
|
let responseText;
|
||||||
const form = document.querySelector('form');
|
const form = document.querySelector('form');
|
||||||
const API_URL = `http://127.0.0.1:8000`
|
|
||||||
|
|
||||||
form.addEventListener("submit", async function(event) {
|
form.addEventListener("submit", async function(event) {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
|
@ -47,13 +46,13 @@ form.addEventListener("submit", async function(event) {
|
||||||
})
|
})
|
||||||
|
|
||||||
async function getUname() {
|
async function getUname() {
|
||||||
let response = await fetch(`${API_URL}/api/users/${uname}`);
|
let response = await fetch(`/api/users/${uname}`);
|
||||||
responseText = await response.text();
|
responseText = await response.text();
|
||||||
return responseText;
|
return responseText;
|
||||||
}
|
}
|
||||||
|
|
||||||
async function loginChange() {
|
async function loginChange() {
|
||||||
const rawResponse = await fetch(`${API_URL}/api/users/change/${uname}/${pin}/${newUname}/${newPin}`, {
|
const rawResponse = await fetch(`/api/users/change/${uname}/${pin}/${newUname}/${newPin}`, {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
headers: {
|
headers: {
|
||||||
'Accept': 'text/plain'
|
'Accept': 'text/plain'
|
||||||
|
|
|
@ -5,7 +5,6 @@ let custom = document.querySelector('#custom').value;
|
||||||
let pronouns = ''
|
let pronouns = ''
|
||||||
let responseText;
|
let responseText;
|
||||||
const form = document.querySelector('form'); // grabbing an element on the page
|
const form = document.querySelector('form'); // grabbing an element on the page
|
||||||
const API_URL = `http://127.0.0.1:8000`
|
|
||||||
|
|
||||||
form.addEventListener("submit", async function(event) {
|
form.addEventListener("submit", async function(event) {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
|
@ -37,13 +36,13 @@ form.addEventListener("submit", async function(event) {
|
||||||
})
|
})
|
||||||
|
|
||||||
async function getUname() {
|
async function getUname() {
|
||||||
let response = await fetch(`${API_URL}/api/users/${uname}`);
|
let response = await fetch(`$/api/users/${uname}`);
|
||||||
responseText = await response.text();
|
responseText = await response.text();
|
||||||
return responseText;
|
return responseText;
|
||||||
}
|
}
|
||||||
|
|
||||||
async function register() {
|
async function register() {
|
||||||
const rawResponse = await fetch(`${API_URL}/api/register/${uname.toString().toLowerCase()}/${pin.toString()}/${pronouns.toString().toLowerCase().replace("/", ".")}`, {
|
const rawResponse = await fetch(`/api/register/${uname.toString().toLowerCase()}/${pin.toString()}/${pronouns.toString().toLowerCase().replace("/", ".")}`, {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
headers: {
|
headers: {
|
||||||
'Accept': 'text/plain'
|
'Accept': 'text/plain'
|
||||||
|
|
|
@ -8,12 +8,17 @@ body {
|
||||||
margin-top: 10%;
|
margin-top: 10%;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
form {
|
||||||
|
width: 100%
|
||||||
|
}
|
||||||
|
|
||||||
#box {
|
#box {
|
||||||
background-color: white;
|
background-color: white;
|
||||||
padding: 5%;
|
padding: 5%;
|
||||||
box-shadow: 10px 10px 10px black;
|
box-shadow: 10px 10px 10px black;
|
||||||
border-radius: 10px;
|
border-radius: 5px;
|
||||||
display:inline-flex;
|
display:inline-flex;
|
||||||
|
width: 20%;
|
||||||
}
|
}
|
||||||
|
|
||||||
#taken {
|
#taken {
|
||||||
|
@ -29,6 +34,7 @@ label {
|
||||||
}
|
}
|
||||||
|
|
||||||
input {
|
input {
|
||||||
|
padding: 3%;
|
||||||
background-color: #55CDFC;
|
background-color: #55CDFC;
|
||||||
border-style: none;
|
border-style: none;
|
||||||
border-bottom-style: solid;
|
border-bottom-style: solid;
|
||||||
|
|
Loading…
Reference in a new issue