feat: initial commit

This commit is contained in:
caturbgs
2021-12-09 09:01:39 +07:00
parent f8fdeefa22
commit f27ddcfe90
55 changed files with 16928 additions and 0 deletions

37
src/store/membership.js Normal file
View File

@@ -0,0 +1,37 @@
import {action, makeAutoObservable} from "mobx";
import {http} from "../utils/http";
export class Membership {
page = 1;
pageSize = 10
data = [];
total_data = 0
constructor(ctx) {
this.ctx = ctx;
makeAutoObservable(this);
}
@action
async getData() {
const response = await http.get(`/user?page=${this.page}&pageSize=${this.pageSize}`);
this.data = response.body.data ?? []
this.total_data = response.body.total_data ?? 0
}
@action
async create(data) {
return await http.post('/user').send(data)
}
@action
async update(id, data) {
return await http.put('/user/' + id).send(data);
}
async delete(id) {
return await http.del('/user/' + id);
}
}