fix grist service

This commit is contained in:
Darius
2026-02-06 19:31:36 +01:00
parent e1ef661a7a
commit d1d0ff55a5

View File

@@ -15,10 +15,19 @@ export class GristService extends BaseService<GristClient> {
);
const query = `${Config.grist.table_personal_goals_path}?filter=${filter_string}`;
const response =
await this.getClient().get<Record<string, unknown>>(query);
const response = await this.getClient().get<{
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 {
const error_message = "error getting record from grist";
logWarning(error_message);