Merge branch 'develop' of https://gitlab.com/empatnusabangsa/ppob/ppob-frontend into develop
This commit is contained in:
@@ -1,50 +1,52 @@
|
||||
import {makeAutoObservable} from "mobx";
|
||||
import {http} from "../utils/http";
|
||||
import { makeAutoObservable } from "mobx";
|
||||
import { http } from "../utils/http";
|
||||
|
||||
export class Role {
|
||||
page = null;
|
||||
pageSize = null;
|
||||
data = [];
|
||||
total_data = 0
|
||||
page = null;
|
||||
pageSize = null;
|
||||
data = [];
|
||||
total_data = 0;
|
||||
|
||||
constructor(ctx) {
|
||||
this.ctx = ctx;
|
||||
makeAutoObservable(this);
|
||||
}
|
||||
constructor(ctx) {
|
||||
this.ctx = ctx;
|
||||
makeAutoObservable(this);
|
||||
}
|
||||
|
||||
async getData() {
|
||||
try {
|
||||
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
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
}
|
||||
async getData(isForMembership = false) {
|
||||
try {
|
||||
const response = await http.get(
|
||||
`/config/roles${isForMembership ? "/for-membership" : ""}?page=${
|
||||
this.page
|
||||
}&pageSize=${this.pageSize}`
|
||||
);
|
||||
this.data = response.body.data ?? [];
|
||||
this.total_data = response.body.total_data ?? 0;
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
}
|
||||
}
|
||||
|
||||
async create(data) {
|
||||
try {
|
||||
return await http.post('/users').send(data)
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
}
|
||||
async create(data) {
|
||||
try {
|
||||
return await http.post("/users").send(data);
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
}
|
||||
}
|
||||
|
||||
async update(id, data) {
|
||||
try {
|
||||
return await http.put('/users/' + id).send(data);
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
}
|
||||
async update(id, data) {
|
||||
try {
|
||||
return await http.put("/users/" + id).send(data);
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
}
|
||||
}
|
||||
|
||||
async delete(id) {
|
||||
try {
|
||||
return await http.del('/users/' + id);
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
}
|
||||
async delete(id) {
|
||||
try {
|
||||
return await http.del("/users/" + id);
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user