@frontegg/nextjs 6.7.10-alpha.3872006763 → 6.7.10-alpha.3901992373
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/CHANGELOG.md +2 -1
- package/README.md +31 -13
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
# Change Log
|
|
2
2
|
|
|
3
|
-
## [6.7.10](https://github.com/frontegg/frontegg-nextjs/compare/v6.7.9...v6.7.10) (2023-1-
|
|
3
|
+
## [6.7.10](https://github.com/frontegg/frontegg-nextjs/compare/v6.7.9...v6.7.10) (2023-1-12)
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
### NextJS Wrapper 6.7.10:
|
|
7
|
+
- FR-10342 - update readme for app directory
|
|
7
8
|
- Update Frontegg AdminPortal to 6.58.0
|
|
8
9
|
- FR-10153 - Fix app session bug without keepSessionAlive
|
|
9
10
|
|
package/README.md
CHANGED
|
@@ -253,19 +253,15 @@ export { FronteggAppRouter as default } from '@frontegg/nextjs/client';
|
|
|
253
253
|
```
|
|
254
254
|
|
|
255
255
|
### server component
|
|
256
|
+
notice that this session is not part of the state and therefore wont trigger ui changes when it changes
|
|
256
257
|
```ts
|
|
257
258
|
// ./app/ServerComponent.tsx
|
|
258
|
-
import {
|
|
259
|
+
import { getSession } from "@frontegg/nextjs/server";
|
|
259
260
|
|
|
260
261
|
export const ServerComponent = async () => {
|
|
261
|
-
const
|
|
262
|
+
const session = await getSession();
|
|
262
263
|
|
|
263
|
-
return
|
|
264
|
-
<div>
|
|
265
|
-
{user.profilePictureUrl && <img src={user.profilePictureUrl} />}
|
|
266
|
-
<span>Logged in as: {user?.name}</span>
|
|
267
|
-
</div>
|
|
268
|
-
) : null;
|
|
264
|
+
return <pre>{JSON.stringify(session, null, 2)}</pre>;
|
|
269
265
|
};
|
|
270
266
|
|
|
271
267
|
```
|
|
@@ -276,8 +272,9 @@ export const ServerComponent = async () => {
|
|
|
276
272
|
"use client";
|
|
277
273
|
import { useAuth, useLoginWithRedirect } from "@frontegg/nextjs";
|
|
278
274
|
|
|
279
|
-
export const ClientComponent = ({ baseUrl }: { baseUrl
|
|
280
|
-
const { isAuthenticated } = useAuth();
|
|
275
|
+
export const ClientComponent = ({ baseUrl }: { baseUrl?: string }) => {
|
|
276
|
+
const { user, isAuthenticated } = useAuth();
|
|
277
|
+
|
|
281
278
|
const loginWithRedirect = useLoginWithRedirect();
|
|
282
279
|
|
|
283
280
|
const logout = () => {
|
|
@@ -285,9 +282,30 @@ export const ClientComponent = ({ baseUrl }: { baseUrl: string }) => {
|
|
|
285
282
|
};
|
|
286
283
|
|
|
287
284
|
return (
|
|
288
|
-
<
|
|
289
|
-
{isAuthenticated ?
|
|
290
|
-
|
|
285
|
+
<div className="App">
|
|
286
|
+
{isAuthenticated ? (
|
|
287
|
+
<div>
|
|
288
|
+
<div>
|
|
289
|
+
<img src={user?.profilePictureUrl} alt={user?.name} />
|
|
290
|
+
</div>
|
|
291
|
+
<div>
|
|
292
|
+
<span>Logged in as: {user?.name}</span>
|
|
293
|
+
</div>
|
|
294
|
+
<div>
|
|
295
|
+
<button onClick={() => alert(user?.accessToken)}>
|
|
296
|
+
What is my access token?
|
|
297
|
+
</button>
|
|
298
|
+
</div>
|
|
299
|
+
<div>
|
|
300
|
+
<button onClick={() => logout()}>Click to logout</button>
|
|
301
|
+
</div>
|
|
302
|
+
</div>
|
|
303
|
+
) : (
|
|
304
|
+
<div>
|
|
305
|
+
<button onClick={() => loginWithRedirect()}>Click me to login</button>
|
|
306
|
+
</div>
|
|
307
|
+
)}
|
|
308
|
+
</div>
|
|
291
309
|
);
|
|
292
310
|
};
|
|
293
311
|
```
|