fix grist service
This commit is contained in:
@@ -15,10 +15,19 @@ export class GristService extends BaseService<GristClient> {
|
|||||||
);
|
);
|
||||||
const query = `${Config.grist.table_personal_goals_path}?filter=${filter_string}`;
|
const query = `${Config.grist.table_personal_goals_path}?filter=${filter_string}`;
|
||||||
|
|
||||||
const response =
|
const response = await this.getClient().get<{
|
||||||
await this.getClient().get<Record<string, unknown>>(query);
|
records: Record<string, Record<string, unknown>>[];
|
||||||
|
}>(query);
|
||||||
|
|
||||||
return this.getSuccessfulResult(this.transformToPersonalGoals(response));
|
if (response.records?.length > 0) {
|
||||||
|
return this.getSuccessfulResult(
|
||||||
|
this.transformToPersonalGoals(response.records[0].fields),
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
const error_message = "error finding record from grist";
|
||||||
|
logWarning(error_message);
|
||||||
|
return this.getErrorResult(error_message);
|
||||||
|
}
|
||||||
} catch {
|
} catch {
|
||||||
const error_message = "error getting record from grist";
|
const error_message = "error getting record from grist";
|
||||||
logWarning(error_message);
|
logWarning(error_message);
|
||||||
|
|||||||
Reference in New Issue
Block a user