Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
…tend into about
  • Loading branch information
Pitsco committed Nov 3, 2023
2 parents de77a9d + 13a84b8 commit c1988c8
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 4 deletions.
4 changes: 4 additions & 0 deletions assets/scripts/graph.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
2 changes: 1 addition & 1 deletion pages/app.html
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
15 changes: 12 additions & 3 deletions pages/signin.html
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@ <h2>Sign In</h2>
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
Expand All @@ -146,15 +147,24 @@ <h2>Sign In</h2>
// 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;
Expand All @@ -165,7 +175,6 @@ <h2>Sign In</h2>
// alert("Signed In!")
// return;
// });
window.location.href = "https://csa-tri-1.github.io/DADDiJkstra-frontend/pages/app";
})
};
</script>
Expand Down

0 comments on commit c1988c8

Please sign in to comment.