hasyrails / calendar-vue-original

0 stars 0 forks source link

残件 / 日時を設定したToDoカードに設定日時が表示されない #382

Closed hasyrails closed 3 years ago

hasyrails commented 3 years ago

日時を設定した後、 カードのstart, endが nullとして登録されている

hasyrails commented 3 years ago

原因

日付のバリデーション設定時に start, endの情報を cardとしてではなく、formで渡すようにしているため

ref #325

何が起こっている??

start, end更新時 $store.state.cardが変更されていない

hasyrails commented 3 years ago

改修完了

作成したformがVuexのアクションを整合が取れていない

form:{
        start: '',
        deadline: '',
      },

最終形

formをpropsのcardと同じにする (start, end は入力するので空で定義)

form:{
        id: this.card.id,
        body: this.card.body,
        description: this.card.description,
        start: '',
        deadline: '',
        schedulized: this.card.schedulized,
        color: this.card.color,
        card_id: this.card.id,
        user_id: this.$store.getters['auth/user'].id,
      },

payload.cardがないこと自体は変わらない。 updateCard mutationを変更

 updateCard(state, payload){
+      const card = state.cards.find((o) => {
+        return o.id === payload.id;
+      });
+      
+      const index = state.cards.findIndex((o) => {
+        return o.id === payload.id
+      })
+      
+      state.cards.splice(index, 1, card)
+     },