Skip to content

Commit

Permalink
feat: Update Crawling Toast
Browse files Browse the repository at this point in the history
  • Loading branch information
Boyzmsc committed Oct 12, 2021
1 parent fb28a1d commit 19f32fd
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/pages/Common/MainHeader.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ export default function MainHeader() {
setShow(true);
} else {
// Fetch data & Reset firestore
setToastText("Crawling Start! Please Wait A Few Seconds...");
setShow(true);
axios
.post("http://localhost:5000/api", {
univ: u,
Expand All @@ -57,9 +59,11 @@ export default function MainHeader() {
// loginPwd: pwd,
// })
.then((res) => {
console.log("Complete fetch data");
let data = res.data;
if (data !== false) {
if (data[0].length == 0 || data[1].length == 0) {
setToastText("Crawling Failed! Please Retry Crawling!");
setShow(true);
} else if (data !== false) {
// Delete & Store lecture
firestore
.collection("users")
Expand All @@ -81,7 +85,6 @@ export default function MainHeader() {
}
})
.then(() => {
console.log("Complete store lecture");
// Delete & Store assignment
firestore
.collection("users")
Expand All @@ -103,7 +106,6 @@ export default function MainHeader() {
}
})
.then(() => {
console.log("Complete store assignment");
setToastText("Complete Crawling! Please Reload Page!");
setShow(true);
});
Expand Down

0 comments on commit 19f32fd

Please sign in to comment.