added afterLogout trigger (#6217)
* added afterLogout trigger * added verification of session object in tests * removed obsolete code * removed unsued code * improved tests to verify user ID
This commit is contained in:
committed by
Diamond Lewis
parent
5cfaaf059a
commit
5ed0885440
@@ -165,6 +165,41 @@ ParseCloud.beforeLogin = function(handler) {
|
||||
);
|
||||
};
|
||||
|
||||
/**
|
||||
*
|
||||
* Registers the after logout function.
|
||||
*
|
||||
* **Available in Cloud Code only.**
|
||||
*
|
||||
* This function is triggered after a user logs out.
|
||||
*
|
||||
* ```
|
||||
* Parse.Cloud.afterLogout((request) => {
|
||||
* // code here
|
||||
* })
|
||||
*
|
||||
* ```
|
||||
*
|
||||
* @method afterLogout
|
||||
* @name Parse.Cloud.afterLogout
|
||||
* @param {Function} func The function to run after a logout. This function can be async and should take one parameter a {@link Parse.Cloud.TriggerRequest};
|
||||
*/
|
||||
ParseCloud.afterLogout = function(handler) {
|
||||
let className = '_Session';
|
||||
if (typeof handler === 'string' || isParseObjectConstructor(handler)) {
|
||||
// validation will occur downstream, this is to maintain internal
|
||||
// code consistency with the other hook types.
|
||||
className = getClassName(handler);
|
||||
handler = arguments[1];
|
||||
}
|
||||
triggers.addTrigger(
|
||||
triggers.Types.afterLogout,
|
||||
className,
|
||||
handler,
|
||||
Parse.applicationId
|
||||
);
|
||||
};
|
||||
|
||||
/**
|
||||
* Registers an after save function.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user