diff --git a/assets/scripts/graph.js b/assets/scripts/graph.js
index 4012056..2884eb0 100644
--- a/assets/scripts/graph.js
+++ b/assets/scripts/graph.js
@@ -309,6 +309,10 @@ function createLink(s, t) {
adj_List.push(Array(maxId).fill(10000));
}
+ for (let i = 0; i < adj_List.length; i++) {
+ adj_List[i][i] = 0;
+ }
+
adj_List[sId - 1][tId - 1] = distance;
adj_List[tId - 1][sId - 1] = distance;
diff --git a/pages/app.html b/pages/app.html
index 9e0faf2..a706868 100644
--- a/pages/app.html
+++ b/pages/app.html
@@ -71,7 +71,7 @@
};
// Backend URL
- const backendURL = 'https://daddjbackend.stu.nighthawkcodingsociety.com/api/dijkstra/';
+ const backendURL = 'http://localhost:8084/api/dijkstra/';
// Creating a new XMLHttpRequest object
const xhr = new XMLHttpRequest();
diff --git a/pages/signin.html b/pages/signin.html
index b79b983..8207faf 100644
--- a/pages/signin.html
+++ b/pages/signin.html
@@ -124,6 +124,7 @@
Sign In
if (response.ok) {
console.log('Successful fetch');
return;
+ window.location.href = "https://csa-tri-1.github.io/DADDiJkstra-frontend/pages/app";
}
// Success!!!
// Redirect to Database location
@@ -146,15 +147,24 @@ Sign In
// Fetch the API
fetch(read_url, options)
.then(response => {
- if (response.ok) {
+ if (response.status === 200) {
console.log(response);
- alert("Signed In!")
+ alert("Signed In!");
return;
+ window.location.href = "https://csa-tri-1.github.io/DADDiJkstra-frontend/pages/app";
}
if (response.status !== 200) {
const errorMsg = 'Database response error: ' + response.status;
console.log(errorMsg);
+ alert("Bad password/username input");
+ return;
+ window.location.href = "https://csa-tri-1.github.io/DADDiJkstra-frontend/pages/app";
+ }
+ if (response.status === 401) {
+ alert("Bad password/username input");
+ console.log(errorMsg);
return;
+ window.location.href = "https://csa-tri-1.github.io/DADDiJkstra-frontend/pages/app";
}
// response.json().then(data => {
// // const jwtToken = data.jwt;
@@ -165,7 +175,6 @@ Sign In
// alert("Signed In!")
// return;
// });
- window.location.href = "https://csa-tri-1.github.io/DADDiJkstra-frontend/pages/app";
})
};