diff --git a/src/store/membership.js b/src/store/membership.js index 0afded7..af33099 100644 --- a/src/store/membership.js +++ b/src/store/membership.js @@ -48,7 +48,11 @@ export class Membership { async create(data) { try { - return await http.post('/users').send(data) + const response = await http.post('/users').send(data); + this.ctx.authentication.userData.role === "Admin" + ? await this.ctx.membership.getData() + : await this.ctx.membership.getDataBySuperior(); + return response; } catch (e) { console.error(e); } @@ -57,8 +61,10 @@ export class Membership { async update(id, data) { try { const response = await http.put('/users/' + id).send(data); - console.log(response, 'Data user') - console.log(JSON.stringify(response.body.data), 'Data') + this.ctx.authentication.userData.role === "Admin" + ? await this.ctx.membership.getData() + : await this.ctx.membership.getDataBySuperior(); + return response; } catch (e) { console.error(e); } @@ -66,11 +72,14 @@ export class Membership { async delete(id) { try { - return await http.del('/users/' + id); + const response = await http.del('/users/' + id); + this.ctx.authentication.userData.role === "Admin" + ? await this.ctx.membership.getData() + : await this.ctx.membership.getDataBySuperior(); + return response; } catch (e) { console.error(e); } - } async changeStatus(id, status) {