Init stack more args (#892)

more doc fixes
This commit is contained in:
BilalG1 2025-09-11 10:20:44 -07:00 committed by GitHub
parent 0c4958afb4
commit a03774f018
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
7 changed files with 15 additions and 15 deletions

View File

@ -37,7 +37,7 @@ For detailed usage instructions, please refer to the manual section of the [setu
```tsx title="app/handler/[...stack].tsx"
import { StackHandler } from '@stackframe/stack';
import { stackServerApp } from "@/stack";
import { stackServerApp } from "@/stack/server";
export default function Handler(props: { params: any, searchParams: any }) {
return (

View File

@ -39,7 +39,7 @@ For detailed usage instructions, please refer to the manual section of the [setu
```tsx title="layout.tsx"
import { StackProvider } from '@stackframe/stack';
import { stackServerApp } from '@/stack';
import { stackServerApp } from '@/stack/server';
function App() {
return (

View File

@ -57,7 +57,7 @@ To check whether a user has a specific permission, use the `getPermission` metho
</TabsContent>
<TabsContent value="server">
```tsx title="Check user permission on the server"
import { stackServerApp } from "@/stack";
import { stackServerApp } from "@/stack/server";
export default async function CheckUserPermission() {
const user = await stackServerApp.getUser({ or: 'redirect' });
@ -105,7 +105,7 @@ To get a list of all permissions a user has, use the `listPermissions` method or
</TabsContent>
<TabsContent value="server">
```tsx title="List user permissions on the server"
import { stackServerApp } from "@/stack";
import { stackServerApp } from "@/stack/server";
export default async function DisplayUserPermissions() {
const user = await stackServerApp.getUser({ or: 'redirect' });
@ -179,7 +179,7 @@ To check whether a user has a specific project permission, use the `getPermissio
</TabsContent>
<TabsContent value="server">
```tsx title="Check user permission on the server"
import { stackServerApp } from "@/stack";
import { stackServerApp } from "@/stack/server";
export default async function CheckGlobalPermission() {
const user = await stackServerApp.getUser({ or: 'redirect' });
@ -225,7 +225,7 @@ To get a list of all global permissions a user has, use the `listPermissions` me
</TabsContent>
<TabsContent value="server">
```tsx title="List global permissions on the server"
import { stackServerApp } from "@/stack";
import { stackServerApp } from "@/stack/server";
export default async function DisplayGlobalPermissions() {
const user = await stackServerApp.getUser({ or: 'redirect' });

View File

@ -78,7 +78,7 @@ Next, we can create a hook/function to check if the user has completed onboardin
</TabsContent>
<TabsContent value="server">
```jsx title="app/onboarding-functions.ts"
import { stackServerApp } from '@/stack';
import { stackServerApp } from '@/stack/server';
import { redirect } from 'next/navigation';
export async function ensureOnboarded() {
@ -116,7 +116,7 @@ You can then use these functions wherever onboarding is required:
<TabsContent value="server">
```jsx title="app/page.tsx"
import { ensureOnboarding } from '@/app/onboarding-functions';
import { stackServerApp } from '@/stack';
import { stackServerApp } from '@/stack/server';
export default async function HomePage() {
await ensureOnboarding();

View File

@ -107,7 +107,7 @@ We recommend using our **setup wizard** for a seamless installation experience.
```tsx title="app/handler/[...stack]/page.tsx"
import { StackHandler } from "@stackframe/stack";
import { stackServerApp } from "@/stack";
import { stackServerApp } from "@/stack/server";
export default function Handler(props: unknown) {
return <StackHandler fullPage app={stackServerApp} routeProps={props} />;
@ -124,7 +124,7 @@ We recommend using our **setup wizard** for a seamless installation experience.
```tsx title="app/layout.tsx"
import React from "react";
import { StackProvider, StackTheme } from "@stackframe/stack";
import { stackServerApp } from "@/stack";
import { stackServerApp } from "@/stack/server";
export default function RootLayout({ children }: { children: React.ReactNode }) {
return (

View File

@ -33,7 +33,7 @@ Sometimes, you want to retrieve the user only if they're signed in, and redirect
Since `useUser()` is a stateful hook, you can't use it on server components. Instead, you can import `stackServerApp` from `stack/client.ts` and call `getUser()`:
```tsx title="my-server-component.tsx"
import { stackServerApp } from "@/stack";
import { stackServerApp } from "@/stack/server";
export default async function MyServerComponent() {
const user = await stackServerApp.getUser(); // or: stackServerApp.getUser({ or: "redirect" })
@ -76,7 +76,7 @@ Middleware can be used whenever it is easy to tell whether a page should be prot
<TabsContent value="server">
```tsx title="my-protected-server-component.tsx"
import { stackServerApp } from "@/stack";
import { stackServerApp } from "@/stack/server";
export default async function MyProtectedServerComponent() {
await stackServerApp.getUser({ or: 'redirect' });
@ -164,7 +164,7 @@ You can sign out the user by redirecting them to `/handler/sign-out` or simply b
<TabsContent value="redirect">
```tsx title="sign-out-link.tsx"
import { stackServerApp } from "@/stack";
import { stackServerApp } from "@/stack/server";
export default async function SignOutLink() {
// stackServerApp.urls.signOut is equal to /handler/sign-out
@ -216,7 +216,7 @@ Stack automatically creates a user profile on sign-up. Let's build a page that d
<TabsContent value="server">
```tsx title="app/profile/page.tsx"
import { stackServerApp } from "@/stack";
import { stackServerApp } from "@/stack/server";
import { UserButton } from "@stackframe/stack";
export default async function Page() {

View File

@ -73,7 +73,7 @@ Now let's create a server action that mints a supabase JWT with the Stack Auth u
```tsx title="/utils/actions.ts"
'use server';
import { stackServerApp } from "@/stack";
import { stackServerApp } from "@/stack/server";
import * as jose from "jose";
export const getSupabaseJwt = async () => {