feat: change status partner & membership

This commit is contained in:
2021-12-15 18:14:02 +07:00
parent 08b82c55ab
commit d0b2aec893
7 changed files with 245 additions and 156 deletions

View File

@@ -12,11 +12,14 @@ export class Membership {
makeAutoObservable(this);
}
@action
async getData() {
const response = await http.get(`/users?page=${this.page}&pageSize=${this.pageSize}`);
console.log(response)
this.data = response.body.data ?? []
this.data = response.body.data.map((item, idx) => {
item.key = idx;
return item
}) ?? []
this.total_data = response.body.total_data ?? 0
}
// async getData() {
@@ -25,12 +28,10 @@ export class Membership {
// this.total_data = response.body.total_data ?? 0
// }
@action
async create(data) {
return await http.post('/users').send(data)
}
@action
async update(id, data) {
// console.log(data)
// console.log(id)
@@ -44,6 +45,12 @@ export class Membership {
return await http.del('/users/' + id);
}
async changeStatus(id, status) {
const response = await http.get(`/users/${id}/${status}`);
await this.getData();
return response;
}
}