Skip to content

Commit 7465609

Browse files
committed
Enable to show error message on label creation
1 parent c194fe2 commit 7465609

File tree

2 files changed

+19
-7
lines changed

2 files changed

+19
-7
lines changed

frontend/components/organisms/labels/LabelCreationForm.vue

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,15 @@
1212
ref="form"
1313
v-model="valid"
1414
>
15+
<v-alert
16+
v-show="showError"
17+
v-model="showError"
18+
type="error"
19+
dismissible
20+
>
21+
The label could not be created.
22+
You cannot use same label name or shortcut key.
23+
</v-alert>
1524
<v-text-field
1625
v-model="labelName"
1726
:rules="labelNameRules"
@@ -64,7 +73,8 @@ export default {
6473
suffixKey: '',
6574
color: '',
6675
labelNameRules,
67-
colorRules
76+
colorRules,
77+
showError: false
6878
}
6979
},
7080
@@ -88,8 +98,13 @@ export default {
8898
background_color: this.color.slice(0, -2),
8999
text_color: '#ffffff'
90100
})
91-
this.reset()
92-
this.cancel()
101+
.then(() => {
102+
this.reset()
103+
this.cancel()
104+
})
105+
.catch(() => {
106+
this.showError = true
107+
})
93108
}
94109
}
95110
}

frontend/store/labels.js

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,13 +52,10 @@ export const actions = {
5252
})
5353
},
5454
createLabel({ commit }, data) {
55-
LabelService.addLabel(data.projectId, data)
55+
return LabelService.addLabel(data.projectId, data)
5656
.then((response) => {
5757
commit('addLabel', response.data)
5858
})
59-
.catch((error) => {
60-
alert(error)
61-
})
6259
},
6360
updateLabel({ commit }, data) {
6461
LabelService.updateLabel(data.projectId, data.id, data)

0 commit comments

Comments
 (0)