@@ -11,6 +11,7 @@ export abstract class AbstractBaserow {
11
11
protected readonly __dirname = path . dirname ( fileURLToPath ( import . meta. url ) )
12
12
private readonly _apiToken = this . _setBaserowToken ( )
13
13
private readonly _baseUrl = 'https://api.baserow.io/api'
14
+ private readonly _url = `${ this . _baseUrl } /database/rows/table`
14
15
protected readonly _themeTableId = ConfigBaserow . THEME_ID
15
16
protected readonly _operatorTableId = ConfigBaserow . OPERATOR_ID
16
17
protected readonly _geographicAreasTableId = ConfigBaserow . GEOGRAPHIC_AREAS_ID
@@ -24,7 +25,7 @@ export abstract class AbstractBaserow {
24
25
25
26
protected async _getTableData < T > ( tableId : number ) : Promise < T [ ] > {
26
27
try {
27
- const response = await axios . get ( `${ this . _baseUrl } /database/rows/table /${ tableId } /?user_field_names=true` , this . _axiosHeader )
28
+ const response = await axios . get ( `${ this . _url } /${ tableId } /?user_field_names=true` , this . _axiosHeader )
28
29
await this . _delay ( 100 )
29
30
// eslint-disable-next-line @typescript-eslint/no-unsafe-return, @typescript-eslint/no-unsafe-member-access
30
31
let results = response . data . results
@@ -44,7 +45,7 @@ export abstract class AbstractBaserow {
44
45
45
46
protected async _getRowData < T > ( tableId : number , rowId : number ) : Promise < T | null > {
46
47
try {
47
- const response = await axios . get ( `${ this . _baseUrl } /database/rows/table /${ tableId } /${ rowId } /?user_field_names=true` , this . _axiosHeader )
48
+ const response = await axios . get ( `${ this . _url } /${ tableId } /${ rowId } /?user_field_names=true` , this . _axiosHeader )
48
49
49
50
// eslint-disable-next-line @typescript-eslint/no-unsafe-return, @typescript-eslint/no-unsafe-member-access
50
51
return response . data
@@ -75,17 +76,18 @@ export abstract class AbstractBaserow {
75
76
throw Error ( 'Baserow token not found.' )
76
77
}
77
78
79
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
78
80
protected async _patchRow ( tableId : number , rowId : number , data : Record < string , any > ) : Promise < void > {
79
81
try {
80
- await axios . patch ( `${ this . _baseUrl } /database/rows/table /${ tableId } /${ rowId } /?user_field_names=true` , data , this . _axiosHeader )
82
+ await axios . patch ( `${ this . _url } /${ tableId } /${ rowId } /?user_field_names=true` , data , this . _axiosHeader )
81
83
} catch ( error ) {
82
84
console . error ( `Error patching row ${ rowId } in table ${ tableId } :` , error )
83
85
}
84
86
}
85
87
86
88
protected async _createRow ( tableId : number , data : Record < string , any > ) : Promise < void > {
87
89
try {
88
- await axios . post ( `${ this . _baseUrl } /database/rows/table /${ tableId } /?user_field_names=true` , data , this . _axiosHeader )
90
+ await axios . post ( `${ this . _url } /${ tableId } /?user_field_names=true` , data , this . _axiosHeader )
89
91
} catch ( error ) {
90
92
console . error ( `Error creating row in table ${ tableId } :` , error )
91
93
}
0 commit comments