diff --git a/frontend/pages/create.vue b/frontend/pages/create.vue
index a309136..d433f14 100644
--- a/frontend/pages/create.vue
+++ b/frontend/pages/create.vue
@@ -9,10 +9,12 @@
Create a note
+
+ A note with the same title already exists
+
@@ -54,24 +56,33 @@
title: '',
tags: []
},
- possibleTags: []
+ possibleTags: [],
+ conflict: false
}),
methods: {
createNote() {
+ this.conflict = false
this.$axios.post(`/notes/${this.form.title}`, {
tags: this.form.tags
- }).then(data => {
- console.log(data)
+ }).then(_ => {
+ this.$router.push("/notes")
}
).catch(e => {
- console.log(e)
+ if (e.response && e.response.status === 409) {
+ this.conflict = true
+ } else {
+ console.log("??")
+ }
})
}
},
mounted() {
this.$axios.get("/tags")
- .then(e => console.log(e.data))
+ .then(e => this.possibleTags = e.data)
+ .catch(e => {
+ console.log(e)
+ })
}
}