feat: 🎸 add support for custom cancel session method
This commit is contained in:
5 files changed
+94
-2
No files matched your search
@@ -1,3 +1,27 @@
|
||||
import Model from '@ember-data/model';
|
||||
import GeneratedSessionModel from '../generated/models/session';
|
||||
|
||||
export default class SessionModel extends Model { }
|
||||
export default class SessionModel extends GeneratedSessionModel {
|
||||
|
||||
// =methods
|
||||
|
||||
/**
|
||||
* Cancels the session via the `cancel` method.
|
||||
* See serializer and adapter for more information.
|
||||
* @param {object} options
|
||||
* @param {object} options.adapterOptions
|
||||
* @return {Promise}
|
||||
*/
|
||||
cancelSession(options = { adapterOptions: {} }) {
|
||||
const defaultAdapterOptions = {
|
||||
method: 'cancel',
|
||||
};
|
||||
return this.save({
|
||||
...options,
|
||||
adapterOptions: {
|
||||
...defaultAdapterOptions,
|
||||
...options.adapterOptions,
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user