create-native-di
Version:
cli สำหรับ react native ที่มีตัวอย่างโครงสร้างพื้นฐานพร้อมใช้งานประกอบไปด้วย package หลักๆ เช่น mobx,moment,lodash และรองรับภาษา javascript es6 และมี di สำหรับสลับ Store ที่จะติดต่อ api กับ fake mockup ที่สร้างขึ้นเอง ^^
24 lines (21 loc) • 568 B
JavaScript
import { observable, action } from "mobx";
export default class JobStore {
constructor(api) {
this._api = api
}
datas = []
getDatas() {
this._api.get(`/job/bydriver`).then(res => {
if (res.code === '00') {
this.datas = res.data
}
})
}
confirmGoods(result, id) {
this._api.put(`/job/signutureconfirm/${id}`, result.encoded ).then(res => {
if (res.code == '00')
this.getDatas()
})
}
}