Skip to content

Commit 6247816

Browse files
committed
fix undefined errors for moveUP and moveDown functions in authors and identifiers screen
1 parent 8929e49 commit 6247816

3 files changed

Lines changed: 5 additions & 1 deletion

File tree

src/components/IdentifierCardEditing.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ export default defineComponent({
105105
default: 0
106106
}
107107
},
108-
setup (props) {
108+
setup () {
109109
// validating of value depends on type
110110
// const valueValidators: Record<IdentifierTypeType, (val: unknown) => true | string > = {
111111
// doi: makeFieldValidator('/definitions/identifier/anyOf/0/properties/value'),

src/components/ScreenAuthors.vue

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,7 @@ export default defineComponent({
127127
}
128128
}
129129
const moveAuthorUp = (index: number) => {
130+
if (authors.value === undefined) return
130131
moveUp(index, authors.value, setAuthors)
131132
if (editingId.value === index && index > 0) {
132133
editingId.value = editingId.value - 1
@@ -135,6 +136,7 @@ export default defineComponent({
135136
}
136137
}
137138
const moveAuthorDown = (index: number) => {
139+
if (authors.value === undefined) return
138140
moveDown(index, authors.value, setAuthors)
139141
if (editingId.value === index && index < authors.value.length - 1) {
140142
editingId.value = editingId.value + 1

src/components/ScreenIdentifiers.vue

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,7 @@ export default defineComponent({
145145
}
146146
}
147147
const moveIdentifierUp = (index: number) => {
148+
if (identifiers.value === undefined) return
148149
moveUp(index, identifiers.value, setIdentifiers)
149150
if (editingId.value === index && index > 0) {
150151
editingId.value = editingId.value - 1
@@ -153,6 +154,7 @@ export default defineComponent({
153154
}
154155
}
155156
const moveIdentifierDown = (index: number) => {
157+
if (identifiers.value === undefined) return
156158
moveDown(index, identifiers.value, setIdentifiers)
157159
if (editingId.value === index && index < identifiers.value.length - 1) {
158160
editingId.value = editingId.value + 1

0 commit comments

Comments
 (0)