diff --git a/js/src/views/Admin/Instances.vue b/js/src/views/Admin/Instances.vue index 2431409fa..12e14c412 100644 --- a/js/src/views/Admin/Instances.vue +++ b/js/src/views/Admin/Instances.vue @@ -21,6 +21,11 @@ {{ $t("Add an instance") }} +

@@ -171,7 +176,6 @@ import { InstanceFilterFollowStatus, InstanceFollowStatus, } from "@/types/enums"; -import { SnackbarProgrammatic as Snackbar } from "buefy"; const { isNavigationFailure, NavigationFailureType } = VueRouter; const INSTANCES_PAGE_LIMIT = 10; @@ -203,6 +207,8 @@ const INSTANCES_PAGE_LIMIT = 10; export default class Follows extends Vue { RouteName = RouteName; + followInstanceLoading = false; + newRelayAddress = ""; instances!: Paginate; @@ -257,6 +263,7 @@ export default class Follows extends Vue { async followInstance(e: Event): Promise { e.preventDefault(); + this.followInstanceLoading = true; const domain = this.newRelayAddress.trim(); // trim to fix copy and paste domain name spaces and tabs try { await this.$apollo.mutate<{ relayFollowings: Paginate }>({ @@ -266,18 +273,18 @@ export default class Follows extends Vue { }, }); this.newRelayAddress = ""; + this.followInstanceLoading = false; this.$router.push({ name: RouteName.INSTANCE, params: { domain }, }); - } catch (err: any) { - if (err.message) { - Snackbar.open({ - message: err.message, - type: "is-danger", - position: "is-bottom", - }); + } catch (error: any) { + if (error.message) { + if (error.graphQLErrors && error.graphQLErrors.length > 0) { + this.$notifier.error(error.graphQLErrors[0].message); + } } + this.followInstanceLoading = false; } }