From: Adam Dullage Date: Sun, 5 May 2024 10:11:15 +0000 (+0100) Subject: Refactor LoadingIndicator to take slot and implement it into SearchResult view X-Git-Url: http://git.99rst.org/?a=commitdiff_plain;h=2add9cccd5d1a55496fa72c16b85433804474e1d;p=flatnotes.git Refactor LoadingIndicator to take slot and implement it into SearchResult view --- diff --git a/client/components/LoadingIndicator.vue b/client/components/LoadingIndicator.vue index 6ec85d4..0b8a88b 100644 --- a/client/components/LoadingIndicator.vue +++ b/client/components/LoadingIndicator.vue @@ -1,7 +1,13 @@ @@ -18,19 +27,27 @@ import SvgIcon from "@jamescoyle/vue-icon"; import { mdiTrafficCone } from "@mdi/js"; import { ref } from "vue"; -defineProps({ hideLoader: Boolean }); +const props = defineProps({ hideLoader: Boolean }); -const failed = ref(false); +const loadSuccessful = ref(null); const failedIconPath = ref(""); const failedMessage = ref(""); +function setLoading() { + loadSuccessful.value = null; +} + function setFailed(message, iconPath) { - failed.value = true; failedMessage.value = message || "Loading Failed"; failedIconPath.value = iconPath || mdiTrafficCone; + loadSuccessful.value = false; +} + +function setLoaded() { + loadSuccessful.value = true; } -defineExpose({ setFailed }); +defineExpose({ setLoading, setFailed, setLoaded });