feat: change status partner & membership
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user