next-auth-mfelfelani72 0.0.48 → 0.0.49

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.
@@ -84,18 +84,13 @@ export function registerHandler(apiUrl) {
84
84
  }, { status: 500 });
85
85
  }
86
86
  if (data.success &&
87
- ((_a = data.data) === null || _a === void 0 ? void 0 : _a.user)) {
87
+ ((_b = (_a = data.data) === null || _a === void 0 ? void 0 : _a.token) === null || _b === void 0 ? void 0 : _b.access_token)) {
88
88
  const cookieStore = await cookies();
89
- const returnTo = (_b = cookieStore.get("returnTo")) === null || _b === void 0 ? void 0 : _b.value;
90
- const lastVisited = (_c = cookieStore.get("lastVisited")) === null || _c === void 0 ? void 0 : _c.value;
89
+ const returnTo = (_c = cookieStore.get("returnTo")) === null || _c === void 0 ? void 0 : _c.value;
90
+ const lastVisited = (_d = cookieStore.get("lastVisited")) === null || _d === void 0 ? void 0 : _d.value;
91
91
  const redirectTo = returnTo ||
92
92
  lastVisited ||
93
93
  "/";
94
- console.log("AUTH REGISTER REDIRECT:", {
95
- returnTo,
96
- lastVisited,
97
- redirectTo,
98
- });
99
94
  const res = NextResponse.json({
100
95
  message: data.message ||
101
96
  "Registration successful",
@@ -110,17 +105,13 @@ export function registerHandler(apiUrl) {
110
105
  path: "/",
111
106
  maxAge: 60 * 60 * 24 * 7,
112
107
  };
113
- if ((_d = data.data.token) === null || _d === void 0 ? void 0 : _d.access_token) {
114
- res.cookies.set(Object.assign(Object.assign({ name: "app_key", value: JSON.stringify({
115
- tk: data.data.token
116
- .access_token,
117
- ud: data.data.user.uuid ||
118
- data.data.user.id,
119
- }) }, cookieOptions), { httpOnly: false }));
120
- res.cookies.set(Object.assign(Object.assign({ name: "key_type", value: data.data.token
121
- .token_type ||
122
- "Bearer" }, cookieOptions), { httpOnly: false }));
123
- }
108
+ res.cookies.set(Object.assign(Object.assign({ name: "app_key", value: JSON.stringify({
109
+ tk: data.data.token.access_token,
110
+ ud: data.data.user.uuid ||
111
+ data.data.user.id,
112
+ }) }, cookieOptions), { httpOnly: false }));
113
+ res.cookies.set(Object.assign(Object.assign({ name: "key_type", value: data.data.token.token_type ||
114
+ "Bearer" }, cookieOptions), { httpOnly: false }));
124
115
  res.cookies.set(Object.assign(Object.assign({ name: "user", value: JSON.stringify(data.data.user) }, cookieOptions), { httpOnly: false }));
125
116
  res.cookies.set(Object.assign(Object.assign({ name: "isLoggedIn", value: "true" }, cookieOptions), { httpOnly: false }));
126
117
  return res;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "next-auth-mfelfelani72",
3
- "version": "0.0.48",
3
+ "version": "0.0.49",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "files": [