Use the useWaitToken hook to complete a wait token from a React component.
We’ve added a new useWaitToken react hook that allows you to complete a wait token from a React component, using a Public Access Token.
backend.ts
Copy
Ask AI
import { wait } from "@trigger.dev/sdk";// Somewhere in your code, you'll need to create the token and then pass the token ID and the public token to the frontendconst token = await wait.createToken({ timeout: "10m",});return { tokenId: token.id, publicToken: token.publicAccessToken, // An automatically generated public access token that expires in 1 hour};
Now you can use the useWaitToken hook in your frontend code: