propro-utils 1.4.45 → 1.4.46

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "propro-utils",
3
- "version": "1.4.45",
3
+ "version": "1.4.46",
4
4
  "description": "Auth middleware for propro-auth",
5
5
  "main": "src/index.js",
6
6
  "scripts": {
@@ -72,9 +72,6 @@ function proproAuthMiddleware(options = {}, userSchema) {
72
72
  const formatedAuthUrl = formatRedirectUrl(authUrl);
73
73
 
74
74
  let response;
75
- let account;
76
- let access;
77
- let refresh;
78
75
 
79
76
  try {
80
77
  response = await post(
@@ -88,12 +85,12 @@ function proproAuthMiddleware(options = {}, userSchema) {
88
85
  },
89
86
  }
90
87
  );
91
-
92
- ({ account, access, refresh } = response.data);
93
88
  } catch (error) {
94
89
  console.error('an error occur: ', error.message);
95
90
  }
96
91
 
92
+ let { account, access, refresh } = response.data;
93
+
97
94
  if (!account || !access || !refresh) {
98
95
  return res
99
96
  .status(401)
@@ -124,6 +121,7 @@ function proproAuthMiddleware(options = {}, userSchema) {
124
121
  );
125
122
 
126
123
  const user = await checkIfUserExists(userSchema, account.accountId);
124
+ console.log('user: ', user);
127
125
 
128
126
  setAuthCookies(res, tokens, account, user);
129
127