remove unneeded refetch in user delete method

This commit is contained in:
Keviin Åberg Kultalahti 2021-05-12 11:15:40 +02:00
parent 1a8fa817d5
commit 0dfa0df335
1 changed files with 2 additions and 1 deletions

View File

@ -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()
} }