citi-hub-session-engine
Version:
Module for authentication methods for CITI hub
32 lines (26 loc) • 998 B
JavaScript
const { logger } = require("../utils/Logger");
const { configurations_key } = require("../utils/Constants");
const updatePasswordUser = async (token, body) => {
try {
logger.info(`Initiating Update Password User`);
const config = global[configurations_key];
const endpoint = config?.updatePasswordUser?.endpoint || "";
logger.info(`Endpoint for update user password: ${endpoint}`);
//INVOKE ENDPOINT, PUT, headers: authorization, body: params
const response = await fetch(endpoint, {
method: "PUT",
headers: {
"Content-Type": "application/json",
Authorization: `Bearer ${token}`,
},
body: JSON.stringify(body),
});
const data = await response.json();
logger.info(`Response from update user password: ${data.code}`);
return data;
} catch (e) {
logger.error(`An error occurred while update user password :: ${e}`);
return null;
}
};
module.exports = updatePasswordUser;