Files
threshold-ui/addons/api/mirage/serializers/auth-method.js
T

18 lines
547 B
JavaScript
Raw Normal View History

2020-06-18 15:51:40 -04:00
import ApplicationSerializer from './application';
export default ApplicationSerializer.extend({
2021-03-04 15:47:38 -05:00
modelName: 'auth-method',
_hashForModel(model) {
const json = ApplicationSerializer.prototype._hashForModel.apply(
this,
arguments
);
// If the scope marks this auth method as primary, designate it
// as such with a read-only boolean field (this is how the API behaves).
2021-03-26 12:47:49 -04:00
const isPrimary =
model.scope && model.scope.primaryAuthMethodId === model.id;
json.primary = isPrimary;
return json;
},
2020-06-18 15:51:40 -04:00
});