From 8ea13f536e08c6b9d27631b14cc1068ad88fa8dc Mon Sep 17 00:00:00 2001 From: MartinsOnuoha Date: Sat, 4 Nov 2023 10:47:12 +0100 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20feat(appaddurlpreview.vue):=20add?= =?UTF-8?q?=20loading=20state=20to=20preview?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/AppAddUrl/AppAddUrl.vue | 18 ++++++++++++++---- src/components/AppAddUrl/AppAddUrlPreview.vue | 7 ++++++- ...dUrlError.vue => AppAddUrlSuccessError.vue} | 0 .../AppAddUrl/_AppAddUrlPreview.scss | 4 +++- 4 files changed, 23 insertions(+), 6 deletions(-) rename src/components/AppAddUrl/{AppAddUrlError.vue => AppAddUrlSuccessError.vue} (100%) diff --git a/src/components/AppAddUrl/AppAddUrl.vue b/src/components/AppAddUrl/AppAddUrl.vue index 9318aba..ced16e2 100644 --- a/src/components/AppAddUrl/AppAddUrl.vue +++ b/src/components/AppAddUrl/AppAddUrl.vue @@ -6,7 +6,7 @@ import { ADD_SAMPLE } from '@/graphql/mutations/samples' import type { Statement } from '@/entities/Statement' import { GET_STATEMENTS } from '@/graphql/queries/statements' import { useValidateOgUrl } from '@/composables/useValidateOgUrl' -import AppAddUrlError from '@/components/AppAddUrl/AppAddUrlError.vue' +import AppAddUrlError from '@/components/AppAddUrl/AppAddUrlSuccessError.vue' import AppAddUrlPreview from '@/components/AppAddUrl/AppAddUrlPreview.vue' const props = defineProps({ @@ -24,7 +24,11 @@ watch(data, (n) => { } }) -const { loading: loadingMutation, mutate: addSample } = useMutation(ADD_SAMPLE, () => ({ +const { + loading: loadingMutation, + mutate: addSample, + error: mutationError +} = useMutation(ADD_SAMPLE, () => ({ variables: { objects: { statement_id: props.statement?.id, @@ -54,6 +58,7 @@ const { loading: loadingMutation, mutate: addSample } = useMutation(ADD_SAMPLE, required name="add-url" v-model="inputValue" + :disabled="loadingValidation || loadingMutation" placeholder="e.g https://dribbble.com/shots..." type="text" /> @@ -62,11 +67,16 @@ const { loading: loadingMutation, mutate: addSample } = useMutation(ADD_SAMPLE, :disabled="!canCreate || loadingValidation || loadingMutation" @click="validate(inputValue)" > - Add Inspiration ✨ + {{ loadingValidation ? 'Validating URL...' : 'Add Inspiration ✨' }} - +