feat(api): Add delete user function to user store

This commit is contained in:
Ferdinand Thiessen 2021-12-02 21:32:43 +01:00
parent 8fca175d39
commit 656d7a9e3c
1 changed files with 7 additions and 0 deletions

View File

@ -65,6 +65,13 @@ export const useUserStore = defineStore({
return data; return data;
}, },
async deleteUser(user: FG.User | string) {
if (typeof user === 'object') user = user.userid;
await api.delete(`/users/${user}`);
this.users = this.users.filter(u => u.userid != user);
},
async uploadAvatar(user: FG.User, file: string | File) { async uploadAvatar(user: FG.User, file: string | File) {
const formData = new FormData(); const formData = new FormData();
formData.append('file', file); formData.append('file', file);