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 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);
|
||||
|
||||
Reference in New Issue
Block a user