remove unneeded refetch in user delete method
This commit is contained in:
parent
7137cc6f60
commit
3d37e3e335
|
@ -1,5 +1,6 @@
|
||||||
import { writable } from "svelte/store"
|
import { writable } from "svelte/store"
|
||||||
import api from "builderStore/api"
|
import api from "builderStore/api"
|
||||||
|
import { update } from "lodash"
|
||||||
|
|
||||||
export function createUsersStore() {
|
export function createUsersStore() {
|
||||||
const { subscribe, set } = writable([])
|
const { subscribe, set } = writable([])
|
||||||
|
@ -31,7 +32,7 @@ export function createUsersStore() {
|
||||||
|
|
||||||
async function del(id) {
|
async function del(id) {
|
||||||
const response = await api.delete(`/api/admin/users/${id}`)
|
const response = await api.delete(`/api/admin/users/${id}`)
|
||||||
init()
|
update(users => (users.filter(user => user._id !== id)))
|
||||||
return await response.json()
|
return await response.json()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue