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',
|
2021-03-24 18:36:34 -04:00
|
|
|
|
|
|
|
|
_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;
|
2021-04-14 11:28:07 -04:00
|
|
|
json.is_primary = isPrimary;
|
2021-03-24 18:36:34 -04:00
|
|
|
return json;
|
|
|
|
|
},
|
2020-06-18 15:51:40 -04:00
|
|
|
});
|