#128 - add submitting state
This commit is contained in:
parent
37a978763c
commit
0d7d8e3f59
1 changed files with 12 additions and 2 deletions
|
|
@ -86,15 +86,22 @@
|
||||||
>
|
>
|
||||||
<label class="sr-only" for="comment">Votre commentaire</label>
|
<label class="sr-only" for="comment">Votre commentaire</label>
|
||||||
<textarea
|
<textarea
|
||||||
|
v-model="draftComment.text"
|
||||||
|
:disabled="isSubmitting ? true : undefined"
|
||||||
name="comment"
|
name="comment"
|
||||||
id="comment"
|
id="comment"
|
||||||
placeholder="Ajouter un commentaire…"
|
placeholder="Ajouter un commentaire…"
|
||||||
rows="5"
|
rows="5"
|
||||||
class="text-sm | rounded-lg bg-black p-12"
|
class="text-sm | rounded-lg bg-black p-12"
|
||||||
v-model="draftComment.text"
|
|
||||||
></textarea>
|
></textarea>
|
||||||
<footer class="flex">
|
<footer class="flex">
|
||||||
<input type="submit" class="btn btn--tranparent" />
|
<input
|
||||||
|
type="submit"
|
||||||
|
class="btn btn--tranparent"
|
||||||
|
:class="{ submitting: isSubmitting }"
|
||||||
|
:value="isSubmitting ? 'En cours' : undefined"
|
||||||
|
:disabled="isSubmitting ? true : undefined"
|
||||||
|
/>
|
||||||
<button class="btn btn--white-10" @click="isAddOpen = false">
|
<button class="btn btn--white-10" @click="isAddOpen = false">
|
||||||
Annuler
|
Annuler
|
||||||
</button>
|
</button>
|
||||||
|
|
@ -128,6 +135,7 @@ const api = useApiStore();
|
||||||
const isAddOpen = ref(false);
|
const isAddOpen = ref(false);
|
||||||
const route = useRoute();
|
const route = useRoute();
|
||||||
const waitingForCommentPosition = ref(false);
|
const waitingForCommentPosition = ref(false);
|
||||||
|
const isSubmitting = ref(false);
|
||||||
|
|
||||||
const sortedComments = computed(() => {
|
const sortedComments = computed(() => {
|
||||||
return [...comments.value].reverse();
|
return [...comments.value].reverse();
|
||||||
|
|
@ -219,7 +227,9 @@ async function addComment(newComment) {
|
||||||
/projects\/.*?(?=\/[^/]+\/[^/]+$)/
|
/projects\/.*?(?=\/[^/]+\/[^/]+$)/
|
||||||
);
|
);
|
||||||
newComment.fileParentUri = matchFileParentUri ? matchFileParentUri[0] : null;
|
newComment.fileParentUri = matchFileParentUri ? matchFileParentUri[0] : null;
|
||||||
|
isSubmitting.value = true;
|
||||||
const newFile = await api.addComment(newComment);
|
const newFile = await api.addComment(newComment);
|
||||||
|
isSubmitting.value = false;
|
||||||
resetDraftComment();
|
resetDraftComment();
|
||||||
isAddOpen.value = false;
|
isAddOpen.value = false;
|
||||||
if (!newFile) return;
|
if (!newFile) return;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue