We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 3f470e9 commit c27750bCopy full SHA for c27750b
src/lib/query.ts
@@ -285,9 +285,12 @@ Query.prototype.exec = async function exec() {
285
}
286
287
return this.model.fromJsonApi(response.data);
288
- } else if (options.op === 'findRelationship') {
+ } else if (options.op === 'findRelationship' && options.related) {
289
+ const property = this.model.schema.relationships[options.related];
290
+ const relationship = property?.name ?? options.related;
291
+
292
const response = await client.client.get<JsonApiBody<JsonApiResource | null>>(
- `/${this.model.type}/${options.id}/${options.related}`,
293
+ `/${this.model.type}/${options.id}/${relationship}`,
294
{
295
params: this.buildParams(),
296
0 commit comments