andifebri 3 lat temu
rodzic
commit
870b297ab1
1 zmienionych plików z 7 dodań i 2 usunięć
  1. 7 2
      controller/user.controller.js

+ 7 - 2
controller/user.controller.js

@@ -65,7 +65,7 @@ exports.addUserPublic = handleError(async (req, res) => {
     verified: false,
   })
 
-  await notifWA2(
+  const notif = await notifWA2(
     '37a9ccba-e1bc-4d02-86e0-3be4c718af2a',
     { nama: nama || 'rahasia', no_hp: no_hp2 },
     [
@@ -76,7 +76,11 @@ exports.addUserPublic = handleError(async (req, res) => {
   )
 
   const accessToken = jwt.sign(
-    { _id: user._id, no_laporan, level },
+    {
+      _id: user._id,
+      no_laporan,
+      level,
+    },
     process.env.SECRET,
     {
       expiresIn: '30m',
@@ -85,6 +89,7 @@ exports.addUserPublic = handleError(async (req, res) => {
 
   data = {
     token: `Bearer ${accessToken}`,
+    no_hp_aktif: notif[0].status == 'success' ? true : false,
   }
 
   return response.success(res, {