feat: add roles in Membership
This commit is contained in:
		| @@ -4,6 +4,7 @@ import {User} from "./user"; | ||||
| import {Membership} from "./membership"; | ||||
| import {Product} from "./product"; | ||||
| import {TokenUtil} from "../utils/token"; | ||||
| import {Role} from "./role"; | ||||
|  | ||||
| export class Store { | ||||
|     ui = new UI(this); | ||||
| @@ -11,6 +12,7 @@ export class Store { | ||||
|     user = new User(this); | ||||
|     membership = new Membership(this); | ||||
|     product = new Product(this); | ||||
|     role = new Role(this); | ||||
|  | ||||
|     constructor() { | ||||
|         TokenUtil.loadToken(); | ||||
|   | ||||
| @@ -15,8 +15,6 @@ export class Membership { | ||||
|     @action | ||||
|     async getData() { | ||||
|         const response = await http.get(`/users/find-by-supperior?page=${this.page}&pageSize=${this.pageSize}`); | ||||
|         // console.log(response, 'Data user') | ||||
|         // console.log(JSON.stringify(response.body.data), 'Data') | ||||
|         this.data = response.body.data ?? [] | ||||
|         this.total_data = response.body.total_data ?? 0 | ||||
|     } | ||||
|   | ||||
							
								
								
									
										34
									
								
								src/store/role.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										34
									
								
								src/store/role.js
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,34 @@ | ||||
| import {makeAutoObservable} from "mobx"; | ||||
| import {http} from "../utils/http"; | ||||
|  | ||||
| export class Role { | ||||
|     page = null; | ||||
|     pageSize = null; | ||||
|     data = []; | ||||
|     total_data = 0 | ||||
|  | ||||
|     constructor(ctx) { | ||||
|         this.ctx = ctx; | ||||
|         makeAutoObservable(this); | ||||
|     } | ||||
|  | ||||
|     async getData() { | ||||
|         const response = await http.get(`/config/roles?page=${this.page}&pageSize=${this.pageSize}`); | ||||
|         this.data = response.body.data ?? [] | ||||
|         this.total_data = response.body.total_data ?? 0 | ||||
|     } | ||||
|  | ||||
|     async create(data) { | ||||
|         return await http.post('/users').send(data) | ||||
|     } | ||||
|  | ||||
|     async update(id, data) { | ||||
|         return await http.put('/users/' + id).send(data); | ||||
|     } | ||||
|  | ||||
|     async delete(id) { | ||||
|         return await http.del('/users/' + id); | ||||
|     } | ||||
| } | ||||
|  | ||||
|  | ||||
		Reference in New Issue
	
	Block a user