Skip to content

Commit

Permalink
Build docs II
Browse files Browse the repository at this point in the history
  • Loading branch information
adamjmcgrath committed Aug 18, 2023
1 parent 46afe1d commit 634d95a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
5 changes: 2 additions & 3 deletions docs/types/session_get_session.GetSession.html
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,7 @@ <h4>Type declaration</h4>
</code><button>Copy</button></pre>
<p><strong>Note:</strong> You can&#39;t write to the cookie in a React Server Component, so updates
to the session like setting the expiry of the rolling session won&#39;t be persisted.
For this, we recommend touching the session in the middleware using <code>getSession</code> or
<code>withMiddlewareAuthRequired</code>.</p>
For this, we recommend interacting with the session in the middleware.</p>
<p>You can also get the session in a page or route in the Edge Runtime:</p>
<pre><code class="language-js"><span class="hl-0">// app/my-api/route.js</span><br/><span class="hl-1">import</span><span class="hl-2"> { </span><span class="hl-3">getSession</span><span class="hl-2"> } </span><span class="hl-1">from</span><span class="hl-2"> </span><span class="hl-4">&#39;@auth0/nextjs-auth0/edge&#39;</span><span class="hl-2">; </span><span class="hl-0">// Note the /edge import</span><br/><br/><span class="hl-1">export</span><span class="hl-2"> </span><span class="hl-1">default</span><span class="hl-2"> </span><span class="hl-5">async</span><span class="hl-2"> </span><span class="hl-5">function</span><span class="hl-2"> </span><span class="hl-6">MyPage</span><span class="hl-2">({ </span><span class="hl-3">params</span><span class="hl-2">, </span><span class="hl-3">searchParams</span><span class="hl-2"> }) {</span><br/><span class="hl-2"> </span><span class="hl-5">const</span><span class="hl-2"> { </span><span class="hl-7">user</span><span class="hl-2"> } = </span><span class="hl-1">await</span><span class="hl-2"> </span><span class="hl-6">getSession</span><span class="hl-2">();</span><br/><span class="hl-2"> </span><span class="hl-1">return</span><span class="hl-2"> </span><span class="hl-8">&lt;</span><span class="hl-11">h1</span><span class="hl-8">&gt;</span><span class="hl-2">My Page</span><span class="hl-8">&lt;/</span><span class="hl-11">h1</span><span class="hl-8">&gt;</span><span class="hl-2">;</span><br/><span class="hl-2">}</span><br/><br/><span class="hl-1">export</span><span class="hl-2"> </span><span class="hl-5">const</span><span class="hl-2"> </span><span class="hl-7">runtime</span><span class="hl-2"> = </span><span class="hl-4">&#39;edge&#39;</span><span class="hl-2">;</span>
</code><button>Copy</button></pre>
Expand All @@ -59,7 +58,7 @@ <h5><code class="tsd-tag ts-flagRest">Rest</code> <span class="tsd-signature-sym
<h4 class="tsd-returns-title">Returns <span class="tsd-signature-type ">Promise</span><span class="tsd-signature-symbol">&lt;</span><a href="../classes/session_session.default.html" class="tsd-signature-type tsd-kind-class">default</a><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">null</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">undefined</span><span class="tsd-signature-symbol">&gt;</span></h4>
<div class="tsd-comment tsd-typography"></div></li></ul></li></ul></div><aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/auth0/nextjs-auth0/blob/d6b6e9a/src/session/get-session.ts#L116">session/get-session.ts:116</a></li></ul></aside></div>
<li>Defined in <a href="https://github.com/auth0/nextjs-auth0/blob/5d993ac/src/session/get-session.ts#L115">session/get-session.ts:115</a></li></ul></aside></div>
<div class="col-sidebar">
<div class="page-menu">
<div class="tsd-navigation settings">
Expand Down
5 changes: 2 additions & 3 deletions docs/types/session_touch_session.TouchSession.html
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,7 @@ <h4>Type declaration</h4>
</code><button>Copy</button></pre>
<p><strong>Note:</strong> You can&#39;t write to the cookie in a React Server Component, so updates
to the session like setting the expiry of the rolling session won&#39;t be persisted.
For this, we recommend touching the session in the middleware using <code>touchSession</code> or
<code>withMiddlewareAuthRequired</code>.</p>
For this, we recommend interacting with the session in the middleware.</p>
<p>You can also touch the session in a page or route in the Edge Runtime:</p>
<pre><code class="language-js"><span class="hl-0">// app/my-api/route.js</span><br/><span class="hl-1">import</span><span class="hl-2"> { </span><span class="hl-3">getSession</span><span class="hl-2"> } </span><span class="hl-1">from</span><span class="hl-2"> </span><span class="hl-4">&#39;@auth0/nextjs-auth0/edge&#39;</span><span class="hl-2">; </span><span class="hl-0">// Note the /edge import</span><br/><br/><span class="hl-1">export</span><span class="hl-2"> </span><span class="hl-1">default</span><span class="hl-2"> </span><span class="hl-5">async</span><span class="hl-2"> </span><span class="hl-5">function</span><span class="hl-2"> </span><span class="hl-6">MyPage</span><span class="hl-2">({ </span><span class="hl-3">params</span><span class="hl-2">, </span><span class="hl-3">searchParams</span><span class="hl-2"> }) {</span><br/><span class="hl-2"> </span><span class="hl-1">await</span><span class="hl-2"> </span><span class="hl-6">touchSession</span><span class="hl-2">();</span><br/><span class="hl-2"> </span><span class="hl-1">return</span><span class="hl-2"> </span><span class="hl-8">&lt;</span><span class="hl-11">h1</span><span class="hl-8">&gt;</span><span class="hl-2">My Page</span><span class="hl-8">&lt;/</span><span class="hl-11">h1</span><span class="hl-8">&gt;</span><span class="hl-2">;</span><br/><span class="hl-2">}</span><br/><br/><span class="hl-1">export</span><span class="hl-2"> </span><span class="hl-5">const</span><span class="hl-2"> </span><span class="hl-7">runtime</span><span class="hl-2"> = </span><span class="hl-4">&#39;edge&#39;</span><span class="hl-2">;</span>
</code><button>Copy</button></pre>
Expand All @@ -60,7 +59,7 @@ <h5><code class="tsd-tag ts-flagRest">Rest</code> <span class="tsd-signature-sym
<h4 class="tsd-returns-title">Returns <span class="tsd-signature-type ">Promise</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">&gt;</span></h4>
<div class="tsd-comment tsd-typography"></div></li></ul></li></ul></div><aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/auth0/nextjs-auth0/blob/d6b6e9a/src/session/touch-session.ts#L117">session/touch-session.ts:117</a></li></ul></aside></div>
<li>Defined in <a href="https://github.com/auth0/nextjs-auth0/blob/5d993ac/src/session/touch-session.ts#L116">session/touch-session.ts:116</a></li></ul></aside></div>
<div class="col-sidebar">
<div class="page-menu">
<div class="tsd-navigation settings">
Expand Down

0 comments on commit 634d95a

Please sign in to comment.