Skip to content

Commit

Permalink
Fix title validation
Browse files Browse the repository at this point in the history
  • Loading branch information
sbont committed Jan 27, 2024
1 parent def21c9 commit ff15c36
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions frontend/src/components/Song.vue
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
<div class="field-flex-col">
<div class="field" v-bind:class="{ static: !editing }">
<div class="control">
<input v-if="editing && draftValues" v-model="draftValues.songbook.title" class="input" type="text"
<input v-if="editing && draftValues" v-model="draftValues.songbook!.title" class="input" type="text"
placeholder="Songbook, hymnal or collection title" />
<span v-else>
{{ song?.songbook?.title }}
Expand Down Expand Up @@ -165,7 +165,7 @@
</button>
</p>
<p v-if="editing" class="control">
<button @click="save" class="button is-link" :class="{ 'is-loading': saving }">
<button @click="save" class="button is-link" :class="{ 'is-loading': saving, 'is-static': v$.$errors.length }">
Save changes
</button>
</p>
Expand Down Expand Up @@ -198,7 +198,7 @@

<div class="text">
<div class="is-size-4">Text</div>
<div v-if="!editing" v-html="song?.text" />
<div v-if="!editing" v-html="song?.text" ></div>
<div v-else>
<editor-content :editor="editor" />
</div>
Expand Down Expand Up @@ -240,7 +240,7 @@ import { Song, Score, Songbook, Categories } from "@/types"
type DraftSongbook = Partial<Songbook>
interface DraftSong extends Omit<Partial<Song>, "songbook"> {
songbook: DraftSongbook
songbook?: DraftSongbook
}
interface DraftScore extends Omit<Partial<Score>, "song"> {
Expand All @@ -267,7 +267,7 @@ const error = ref(null);
const rules = {
title: { required },
}
const v$ = useVuelidate<DraftSong>(rules, draftValues.value as DraftSong)
const v$ = useVuelidate<DraftSong>(rules, draftValues as DraftSong)
const editor = useEditor({
content: null,
extensions: [
Expand Down

0 comments on commit ff15c36

Please sign in to comment.