Improvement from PR comments

This commit is contained in:
Pedro Silva 2022-10-20 15:31:10 +01:00
parent 2a4eedcf38
commit d3337a0219
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]
}