1
0
Fork 0
mirror of synced 2024-06-22 16:10:40 +12:00

Improvement from PR comments

This commit is contained in:
Pedro Silva 2022-10-20 15:31:10 +01:00
parent 50aaacb903
commit 312e766414
2 changed files with 6 additions and 10 deletions

View file

@ -49,10 +49,6 @@ export interface Table extends Document {
sourceId?: string
relatedFormula?: string[]
constrained?: string[]
_id?: string
_rev?: string
createdAt?: string
updatedAt?: string
indexes?: { [key: string]: any }
dataImport?: { [key: string]: any }
}

View file

@ -9,19 +9,19 @@ export default class RowsApi {
this.api = apiClient
}
async getAll(id: string): Promise<[Response, Row[]]> {
const response = await this.api.get(`/${id}/rows`)
async getAll(tableId: string): Promise<[Response, Row[]]> {
const response = await this.api.get(`/${tableId}/rows`)
const json = await response.json()
return [response, json]
}
async add(id: string, body: any): Promise<[Response, Row]> {
const response = await this.api.post(`/${id}/rows`, { body })
async add(tableId: string, body: any): Promise<[Response, Row]> {
const response = await this.api.post(`/${tableId}/rows`, { body })
const json = await response.json()
return [response, json]
}
async delete(id: string, body: any): Promise<[Response, Row[]]> {
const response = await this.api.del(`/${id}/rows/`, { body })
async delete(tableId: string, body: any): Promise<[Response, Row[]]> {
const response = await this.api.del(`/${tableId}/rows/`, { body })
const json = await response.json()
return [response, json]
}