Skip to content

Access to relationships.*.data.id #400

Description

@ef4

Given a server that includes data references for unloaded relationships:

{
  relationships: {
    organization: {
      data: { type: "organizations", id: "2" },
      links: { related: "https://example.com/org/2" }
    }
  }
}

Is there public API for accessing the data.type and data.id from an ember-orbit model?

I was able to work around by creating a getter on my model:

get organizationId() {
  let { type, id } = this.$getData().relationships.organization.data;
  return this.$store.keyMap.idToKey(type, 'remoteId', id);
}

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions