diff --git a/src/grist/service.ts b/src/grist/service.ts index 7c7c90a..820df76 100644 --- a/src/grist/service.ts +++ b/src/grist/service.ts @@ -15,10 +15,19 @@ export class GristService extends BaseService { ); const query = `${Config.grist.table_personal_goals_path}?filter=${filter_string}`; - const response = - await this.getClient().get>(query); + const response = await this.getClient().get<{ + records: Record>[]; + }>(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 { const error_message = "error getting record from grist"; logWarning(error_message);