|
|
@@ -41,12 +41,12 @@ exports.login = handleError(async (req, res) => {
|
|
|
user_id: user.id,
|
|
|
})
|
|
|
let role = null
|
|
|
- if (process.env.ENV === 'production') {
|
|
|
+ //if (process.env.ENV === 'production') {
|
|
|
role = user.peran.filter((e) => roleDataProduction.includes(e.peran.id))[0]
|
|
|
role.peran.id = convertRole(role.peran.id)
|
|
|
- } else {
|
|
|
- role = user.peran.filter((e) => roleDataProduction.includes(e.peran.id))[0]
|
|
|
- }
|
|
|
+ /*} else {
|
|
|
+ role = user.peran.filter((e) => roleData.includes(e.peran.id))[0]
|
|
|
+ }*/
|
|
|
let dataRole = {
|
|
|
id: role.peran.id,
|
|
|
nama: role.peran.nama,
|
|
|
@@ -65,7 +65,7 @@ exports.login = handleError(async (req, res) => {
|
|
|
isPrivate: false,
|
|
|
})
|
|
|
} else {
|
|
|
- if (process.env.ENV === 'production') {
|
|
|
+ //if (process.env.ENV === 'production') {
|
|
|
if (cekUser.role.id !== role.peran.id) {
|
|
|
await userModel.updateOne({ _id: cekUser._id }, { role: dataRole })
|
|
|
}
|
|
|
@@ -80,7 +80,7 @@ exports.login = handleError(async (req, res) => {
|
|
|
user_id: user.id,
|
|
|
})
|
|
|
}
|
|
|
- }
|
|
|
+ //}
|
|
|
}
|
|
|
|
|
|
const accessToken = jwt.sign({ _id: cekUser._id }, process.env.SECRET, {
|