You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hey,
first thanks for the great package and your effort!
The primary key of my Model is under data.id, the problem is, that Javascript can't resolve an Object by string dot notation.
It try's to check if my Model instance has a valid ID with the hasId Method. Insides the hasId Method it try's to access the primaryKey through getPrimaryKey() with this[this.primaryKey()];.
This would be equivalent to access an object like this and resolves to undefined:
const o = {
data: {
id: 1,
},
};
o['data.id'];
// my model
export default class User extends Model {
primaryKey() {
return 'data.id';
}
resource() {
return 'users';
}
}
Is there any other solution? If not i think it should be possible to access objects through a provided path as a string.
The text was updated successfully, but these errors were encountered:
Hey,
first thanks for the great package and your effort!
The primary key of my Model is under
data.id
, the problem is, that Javascript can't resolve an Object by string dot notation.It try's to check if my Model instance has a valid ID with the
hasId
Method. Insides thehasId
Method it try's to access the primaryKey throughgetPrimaryKey()
withthis[this.primaryKey()];
.This would be equivalent to access an object like this and resolves to undefined:
Is there any other solution? If not i think it should be possible to access objects through a provided path as a string.
The text was updated successfully, but these errors were encountered: