feat: 🎸 add API and mock support for primary auth methods
This commit is contained in:
8 files changed
+120
-3
No files matched your search
@@ -0,0 +1,18 @@
|
||||
import ApplicationSerializer from './application';
|
||||
|
||||
export default class AuthMethodSerializer extends ApplicationSerializer {
|
||||
/**
|
||||
* Sorts the array in order of "primary" such that the primary method appears
|
||||
* first. The "natural" order of auth methods places primary first.
|
||||
*
|
||||
* @override
|
||||
* @return {object}
|
||||
*/
|
||||
normalizeArrayResponse() {
|
||||
const normalized = super.normalizeArrayResponse(...arguments);
|
||||
normalized.data = normalized.data.sort((a) =>
|
||||
a.attributes.primary ? -1 : 1
|
||||
);
|
||||
return normalized;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user