N
N
nikkon822020-09-01 16:39:23
Vue.js
nikkon82, 2020-09-01 16:39:23

How to update state after softdelete or restore?

Bundle vuex + laravel 7.
List of users with delete or restore buttons (if there is deleted_at)

When deleting, it is necessary that the state is updated and the deleted_at field of this user is updated
In the database, everything is fine - the deleted_at field is updated, but the state is not updated reactively

Tell me how to implement it?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
N
nikkon82, 2020-09-02
@nikkon82

state.users.map(u => {
     if (u.id === user.id) {
         for (let key in user) {
              u[key] = user[key]
          }
    }
 })

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question