Skip to content

Commit

Permalink
feat: add toasts on error
Browse files Browse the repository at this point in the history
  • Loading branch information
SalmaElsoly committed Aug 15, 2024
1 parent 503e737 commit 6a813d4
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 5 deletions.
3 changes: 3 additions & 0 deletions frontend/src/components/FollowUp.vue
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ import Navbar from "./Navbar.vue";
import { useRoute, useRouter } from "vue-router";
import Footer from "./Footer.vue";
import axios from "axios";
import { toast } from "vue3-toastify";
import "vue3-toastify/dist/index.css";
const pending = ref<boolean>(true);
const api = axios.create({
Expand Down Expand Up @@ -74,6 +76,7 @@ const pullLists = async () => {
pending.value = false;
errMsg.value = error.response?.data;
stopPolling.value = true;
toast.error(error.response?.data)
}
};
Expand Down
8 changes: 4 additions & 4 deletions frontend/src/components/Home.vue
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,7 @@
style="height: fit-content"
>
<h2 class="mb-2" v-if="username.length != 0">
<v-icon icon="mdi-account" color="#1aa18f"></v-icon
>{{ username }}
<v-icon icon="mdi-account" color="#1aa18f"></v-icon>{{ username }}
</h2>
<!-- table containe flists -->
<v-data-table
Expand Down Expand Up @@ -94,7 +93,7 @@ import image from "../assets/side.png";
import { useClipboard } from "@vueuse/core";
import { FlistsResponseInterface, FlistBody } from "../types/Flists.ts";
import { toast } from "vue3-toastify";
import "vue3-toastify/dist/index.css";
const baseURL = import.meta.env.VITE_API_URL;
const api = axios.create({
Expand Down Expand Up @@ -152,8 +151,9 @@ onMounted(async () => {
flists.value = (await api.get<FlistsResponseInterface>("/v1/api/fl")).data;
getUserNames();
filteredFlistFn();
} catch (error) {
} catch (error: any) {
console.error("Failed to fetch flists", error);
toast.error(error.response?.data);
}
});
watch(username, () => {
Expand Down
3 changes: 2 additions & 1 deletion frontend/src/components/UserFlist.vue
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,9 @@ onMounted(async () => {
currentUserFlists = computed(() => {
return loggedInUser?.length ? flists.value[loggedInUser] : [];
});
} catch (error) {
} catch (error:any) {
console.error("Failed to fetch flists", error);
toast.error(error.response?.data)
}
});
</script>

0 comments on commit 6a813d4

Please sign in to comment.