Bug Fixing PPOB
This commit is contained in:
67
src/store/approval.js
Normal file
67
src/store/approval.js
Normal file
@@ -0,0 +1,67 @@
|
||||
import {makeAutoObservable} from "mobx";
|
||||
import {http} from "../utils/http";
|
||||
|
||||
export class Approval {
|
||||
page = 0;
|
||||
pageSize = 10
|
||||
data = [];
|
||||
listImage=[];
|
||||
total_data = 0;
|
||||
|
||||
constructor(ctx) {
|
||||
this.ctx = ctx;
|
||||
makeAutoObservable(this);
|
||||
}
|
||||
|
||||
async getData() {
|
||||
try {
|
||||
const response = await http.get(`/users/find-by-approval?page=${this.page}&pageSize=${this.pageSize}`);
|
||||
console.log(response)
|
||||
this.data = response.body.data ?? []
|
||||
this.listImage= this.data.user_detail?.image_store ? JSON.parse(this.data.user_detail?.image_store) : []
|
||||
this.total_data = response.body.count ?? 0
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
}
|
||||
}
|
||||
|
||||
async approveUser(id) {
|
||||
try {
|
||||
const response = await http.put(`/users/approve-user/${id}`);
|
||||
await this.getData();
|
||||
return response;
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
}
|
||||
}
|
||||
async rejectUser(id) {
|
||||
try {
|
||||
const response = await http.put(`/users/reject-user/${id}`);
|
||||
await this.getData();
|
||||
return response;
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
}
|
||||
}
|
||||
|
||||
async resendUser(id) {
|
||||
try {
|
||||
const response = await http.put(`/users/resend-user/${id}`);
|
||||
await this.getData();
|
||||
return response;
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
}
|
||||
}
|
||||
// async delete(id) {
|
||||
// try {
|
||||
// const response = await http.del(`/product/${id}`);
|
||||
// await this.getData();
|
||||
// return response;
|
||||
// } catch (e) {
|
||||
// console.error(e);
|
||||
// }
|
||||
// }
|
||||
}
|
||||
|
||||
|
||||
@@ -12,6 +12,8 @@ import { Category } from "./category";
|
||||
import { Subcategory } from "./subcategory";
|
||||
import { Payback } from "./payback";
|
||||
import { Role } from "./role";
|
||||
import { Approval } from "./approval";
|
||||
|
||||
|
||||
export class Store {
|
||||
ui = new UI(this);
|
||||
@@ -27,6 +29,7 @@ export class Store {
|
||||
transaction = new Transaction(this);
|
||||
subcategory = new Subcategory(this);
|
||||
role = new Role(this);
|
||||
approval = new Approval(this);
|
||||
|
||||
constructor() {
|
||||
TokenUtil.loadToken();
|
||||
|
||||
@@ -47,7 +47,7 @@ export class Membership {
|
||||
async getDetail(id) {
|
||||
try {
|
||||
const response = await http.get(`/users/`+id);
|
||||
//console.log(response,'Data Detail')
|
||||
console.log(response,'Data Detail')
|
||||
this.dataDetail = response.body.data
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
@@ -114,6 +114,7 @@ export class Membership {
|
||||
async changeStatus(id, status) {
|
||||
try {
|
||||
const response = await http.get(`/users/${id}/${status}`);
|
||||
console.log(status,"change status")
|
||||
await this.getData();
|
||||
return response;
|
||||
} catch (e) {
|
||||
|
||||
Reference in New Issue
Block a user