
class TableServer {
  async getAll(callback) {
    return  await window.framework.http.get('/table/index', {})
  }

  async add(row, callback) {
    return  await window.framework.http.post('/table/add', row)
  }

  async edit(row, callback) {
    return  await window.framework.http.post('/table/edit', row, function(res) {
      callback && callback(res)
    })
  }

  async del(row, callback) {
    return  await window.framework.http.post('/table/del', row)
  }

  async autoApi(id) {
    return  await window.framework.http.get('/template/api', { id: id })
  }

  async autoDb(id) {
    return  await window.framework.http.get('/template/autoDb', { id: id })
  }
}

const tableServer = new TableServer()
export default tableServer
