Skip to content

Commit

Permalink
Solved Hardcoded backend URL in the application
Browse files Browse the repository at this point in the history
  • Loading branch information
ygowthamr committed Oct 14, 2024
1 parent 1fce91a commit c5c8ecc
Show file tree
Hide file tree
Showing 14 changed files with 253 additions and 248 deletions.
10 changes: 5 additions & 5 deletions public/dashboard.html
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@
const state = document.getElementById('state');
const year = document.getElementById('year');
const course = document.getElementById('course');
const response = await fetch('http://localhost:3000/dashboard', {
const response = await fetch('/dashboard', {
headers: {
'Authorization': `Bearer ${token}`,
},
Expand Down Expand Up @@ -134,7 +134,7 @@
const token = localStorage.getItem('accessToken');
const headers = new Headers();
headers.append('Authorization', `Bearer ${token}`);
const response = await fetch('http://localhost:3000/result', {
const response = await fetch('/result', {
headers: {
'Content-Type': 'application/json',
'Authorization': `Bearer ${token}`,
Expand All @@ -152,8 +152,8 @@
const result = document.getElementById('result')
result.innerHTML = "Result not declared yet!"
result.style.color = "red"
result.style.padding="16px"
result.style.fontSize="18px"
result.style.padding = "16px"
result.style.fontSize = "18px"
}
else {
console.log("an error occured")
Expand All @@ -162,4 +162,4 @@
</script>
</body>

</html>
</html>
18 changes: 9 additions & 9 deletions public/fac_login.html
Original file line number Diff line number Diff line change
Expand Up @@ -44,14 +44,14 @@ <h4 style="text-align: center; margin: 0px 0px 10px 0px;font-size: 22px;">(for F
</div>
</div>
<script>
var icon =document.getElementById("icon");
icon.onclick = function(){
var icon = document.getElementById("icon");
icon.onclick = function () {
document.body.classList.toggle("dark-theme");
if(document.body.classList.contains("dark-theme")){
icon.src="images/sun.png";
if (document.body.classList.contains("dark-theme")) {
icon.src = "images/sun.png";
}
else{
icon.src="images/moon.png";
else {
icon.src = "images/moon.png";
}
}

Expand All @@ -75,8 +75,8 @@ <h4 style="text-align: center; margin: 0px 0px 10px 0px;font-size: 22px;">(for F
alert('Please use a valid email from Gmail, Outlook, or other reputable providers.');
return;
}
const response = await fetch('http://localhost:3000/fac_login', {

const response = await fetch('/fac_login', {
method: "POST",
headers: {
'Content-Type': 'application/json'
Expand Down Expand Up @@ -126,4 +126,4 @@ <h4 style="text-align: center; margin: 0px 0px 10px 0px;font-size: 22px;">(for F
</script>
</body>

</html>
</html>
18 changes: 9 additions & 9 deletions public/faculty.html
Original file line number Diff line number Diff line change
Expand Up @@ -127,21 +127,21 @@ <h4>Quality and Guidelines</h4>
</div>
</div>
<script>
var icon =document.getElementById("icon");
icon.onclick = function(){
var icon = document.getElementById("icon");
icon.onclick = function () {
document.body.classList.toggle("dark-theme");
if(document.body.classList.contains("dark-theme")){
icon.src="images/sun.png";
if (document.body.classList.contains("dark-theme")) {
icon.src = "images/sun.png";
}
else{
icon.src="images/moon.png";
else {
icon.src = "images/moon.png";
}
}
const Dis_fac_papers = async () => {
const token = localStorage.getItem('accessToken');
const headers = new Headers();
headers.append('Authorization', `Bearer ${token}`);
const response = await fetch('http://localhost:3000/fac_papers', {
const response = await fetch('/fac_papers', {
headers: {
'Authorization': `Bearer ${token}`,
}
Expand Down Expand Up @@ -197,7 +197,7 @@ <h4>Quality and Guidelines</h4>
// const value5= rating5 ? rating5.value : undefined
console.log(rating1, rating2, rating3, rating4)
const data = { rating1, rating2, rating3, rating4 }
const response = await fetch(`http://localhost:3000/rating?id=${id}`, {
const response = await fetch(`/rating?id=${id}`, {
method: 'POST',
headers: {
'Content-Type': 'application/json'
Expand Down Expand Up @@ -234,4 +234,4 @@ <h4>Quality and Guidelines</h4>
</script>
</body>

</html>
</html>
6 changes: 2 additions & 4 deletions public/form_filling.html
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@
headers.append('Authorization', `Bearer ${token}`);

try {
const response = await fetch('http://localhost:3000/info', {
const response = await fetch('/info', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
Expand All @@ -129,8 +129,6 @@
body: JSON.stringify(data),
});

console.log(response.status);

if (response.status == 200) {
console.log("Information saved");
result.style.display = "inline-block";
Expand All @@ -157,7 +155,7 @@
const token = localStorage.getItem('accessToken');
const headers = new Headers();
headers.append('Authorization', `Bearer ${token}`);
const response = await fetch('http://localhost:3000/form_filling', {
const response = await fetch('/form_filling', {
headers: {
'Authorization': `Bearer ${token}`,
},
Expand Down
18 changes: 9 additions & 9 deletions public/login.html
Original file line number Diff line number Diff line change
Expand Up @@ -44,14 +44,14 @@ <h4 style="text-align: center; margin: 10px 0px 6px 0px;font-size: 22px;">(for R
</div>

<script>
var icon =document.getElementById("icon");
icon.onclick = function(){
var icon = document.getElementById("icon");
icon.onclick = function () {
document.body.classList.toggle("dark-theme");
if(document.body.classList.contains("dark-theme")){
icon.src="images/sun.png";
if (document.body.classList.contains("dark-theme")) {
icon.src = "images/sun.png";
}
else{
icon.src="images/moon.png";
else {
icon.src = "images/moon.png";
}
}

Expand All @@ -77,7 +77,7 @@ <h4 style="text-align: center; margin: 10px 0px 6px 0px;font-size: 22px;">(for R
}

try {
const response = await fetch('http://localhost:3000/login', {
const response = await fetch('/login', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
Expand All @@ -102,7 +102,7 @@ <h4 style="text-align: center; margin: 10px 0px 6px 0px;font-size: 22px;">(for R
setTimeout(() => {
result4.style.display = 'none';
}, 2000);
}
}
else if (response.status === 404) {
result2.style.display = 'block';
console.log('User not found');
Expand All @@ -128,4 +128,4 @@ <h4 style="text-align: center; margin: 10px 0px 6px 0px;font-size: 22px;">(for R
</script>
</body>

</html>
</html>
4 changes: 2 additions & 2 deletions public/script/approval.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ const fetchuploadfiles = async () => {
const token = localStorage.getItem("accessToken");
const headers = new Headers();
headers.append("Authorization", `Bearer ${token}`);
const response = await fetch("http://localhost:3000/api/stk_papers", {
const response = await fetch("/api/stk_papers", {
headers: {
Authorization: `Bearer ${token}`,
},
Expand Down Expand Up @@ -116,7 +116,7 @@ const approval = async (id) => {
const token = localStorage.getItem("accessToken");
const headers = new Headers();
headers.append("Authorization", `Bearer ${token}`);
const response = await fetch(`http://localhost:3000/approval?id=${id}`, {
const response = await fetch(`/approval?id=${id}`, {
headers: {
Authorization: `Bearer ${token}`,
},
Expand Down
4 changes: 2 additions & 2 deletions public/script/paper_allotment.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ const fetchuploadfiles = async () => {
const token = localStorage.getItem("accessToken");
const headers = new Headers();
headers.append("Authorization", `Bearer ${token}`);
const response = await fetch("http://localhost:3000/allotment", {
const response = await fetch("/allotment", {
headers: {
Authorization: `Bearer ${token}`,
},
Expand Down Expand Up @@ -109,7 +109,7 @@ const display = async (id) => {
// allotment code for faculty
const fac_allotment = async (id) => {
const email = document.getElementById("fac_mail").value;
const response = fetch(`http://localhost:3000/paper_allot?id=${id}`, {
const response = fetch(`/paper_allot?id=${id}`, {
method: "POST",
headers: {
"Content-Type": "application/json",
Expand Down
Loading

0 comments on commit c5c8ecc

Please sign in to comment.