diff --git a/src/User/User.js b/src/User/User.js index cbae3c1f..a475788f 100644 --- a/src/User/User.js +++ b/src/User/User.js @@ -72,13 +72,27 @@ class User { return Rest.post({ path: `v1/User/change-password/`, body }); }; + /** + * Get authenticated username + * @returns {string} username + */ + getUsername = () => { + return this.tokenData?.message?.name; + }; + + //======================================================================================== + /* * + * Static Methods * + * */ + //======================================================================================== + /** * Reset user password + * @param {string} userId : userId to change password * @param {{new_password: string, confirm_password: string}} body : Request body * @returns {Promise} Response promise */ - resetPassword = async body => { - const userId = this.tokenData.message.name; + static resetPassword = async (userId, body) => { return Rest.post({ path: `v1/User/${userId}/reset-password/`, body }); }; }