Merge branch 'develop' into 'devops-staging'

fix: add refresh after crd operation in membership

See merge request empatnusabangsa/ppob/ppob-frontend!10
This commit is contained in:
Catur Bagaskara 2021-12-22 16:37:36 +00:00
commit 5cb44eb4b6

View File

@ -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) {