Преглед изворни кода

Fix incorrect default values and server response in list creation UI

Kailash Nadh пре 5 година
родитељ
комит
1ef1c5a61c
2 измењених фајлова са 5 додато и 5 уклоњено
  1. 1 1
      cmd/lists.go
  2. 4 4
      frontend/src/views/ListForm.vue

+ 1 - 1
cmd/lists.go

@@ -107,7 +107,7 @@ func handleCreateList(c echo.Context) error {
 	// Hand over to the GET handler to return the last insertion.
 	c.SetParamNames("id")
 	c.SetParamValues(fmt.Sprintf("%d", newID))
-	return c.JSON(http.StatusOK, handleGetLists(c))
+	return handleGetLists(c)
 }
 
 // handleUpdateList handles list modification.

+ 4 - 4
frontend/src/views/ListForm.vue

@@ -67,9 +67,9 @@ export default Vue.extend({
       // Binds form input values.
       form: {
         name: '',
-        type: '',
-        optin: '',
-        tags: '',
+        type: 'private',
+        optin: 'single',
+        tags: [],
       },
     };
   },
@@ -114,7 +114,7 @@ export default Vue.extend({
   },
 
   mounted() {
-    this.form = { ...this.$props.data };
+    this.form = { ...this.form, ...this.$props.data };
 
     this.$nextTick(() => {
       this.$refs.focus.focus();