jeudi 24 janvier 2019

Dynamic primaryKey on ember serializer

I am trying to set primaryKey on ember seializer dynamically. Is it possible?

Here is what I can get from the server as response

account: {iban: "ibanValue", currency : "currencyValue"} or {bban: "bbanValue"}

import DS from 'ember-data';
import ApplicationSerializer from './application';

const {
  EmbeddedRecordsMixin,
} = DS;

export default ApplicationSerializer.extend(EmbeddedRecordsMixin, {
  primaryKey: 'iban'
});

I setted primaryKey to 'iban' but it can be 'bban'. How can I set one of them as primaryKey?




Aucun commentaire:

Enregistrer un commentaire