-
-
Notifications
You must be signed in to change notification settings - Fork 90
add login and pro platform features to react flow docs #699
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
@dimaMachina is attempting to deploy a commit to the xyflow Team on Vercel. A member of the Team first needs to authorize it. |
// Must set `nhostRefreshTokenExpiresAt` | ||
// https://github.com/nhost/nhost/blob/c0635ae1c7d5fe3bd889d11291ebc6978e866647/packages/hasura-auth-js/src/machines/authentication/machine.ts#L647C15-L649C81 | ||
// const nextRefresh = new Date(Date.now() + session.accessTokenExpiresIn * 1_000) | ||
// const value = nextRefresh.toISOString(); | ||
// console.log({value}) | ||
// cookieStore.set(NHOST_JWT_EXPIRES_AT_KEY, nextRefresh.getTime(), { path: '/' }) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// Must set `nhostRefreshTokenExpiresAt` | |
// https://github.com/nhost/nhost/blob/c0635ae1c7d5fe3bd889d11291ebc6978e866647/packages/hasura-auth-js/src/machines/authentication/machine.ts#L647C15-L649C81 | |
// const nextRefresh = new Date(Date.now() + session.accessTokenExpiresIn * 1_000) | |
// const value = nextRefresh.toISOString(); | |
// console.log({value}) | |
// cookieStore.set(NHOST_JWT_EXPIRES_AT_KEY, nextRefresh.getTime(), { path: '/' }) |
// const refreshTokenValue = cookieStore.get(NHOST_REFRESH_KEY)?.value; | ||
// if (refreshTokenValue) { | ||
// const { error, session } = await nhost.auth.refreshSession(refreshTokenValue); | ||
// if (error) { | ||
// console.error(error); | ||
// } | ||
// } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// const refreshTokenValue = cookieStore.get(NHOST_REFRESH_KEY)?.value; | |
// if (refreshTokenValue) { | |
// const { error, session } = await nhost.auth.refreshSession(refreshTokenValue); | |
// if (error) { | |
// console.error(error); | |
// } | |
// } |
}; | ||
|
||
loadFiles(); | ||
// eslint-disable-next-line react-hooks/exhaustive-deps |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// eslint-disable-next-line react-hooks/exhaustive-deps | |
// eslint-disable-next-line react-hooks/exhaustive-deps -- only on mount |
"file-saver": "2.0.5", | ||
"jszip": "3.10.1", | ||
"@apollo/client": "3.7.15", | ||
"fathom-client": "3.5.0", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i think we already have it
"next-sitemap": "^4.2.3", | ||
"nextra": "^4.3.0-alpha.22", | ||
"nextra-theme-docs": "^4.3.0-alpha.22", | ||
"react": "^18.3.1", | ||
"react-dom": "^18.3.1", | ||
"react-icons": "^5.5.0", | ||
"timeago-react": "^3.0.7", | ||
"ui-components": "workspace:*", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ui components not used in this repo
teamPlan: SubscriptionPlan; | ||
}> { | ||
const nhost = await getNhost(); | ||
const userId = nhost.auth.getUser()!.id!; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const userId = nhost.auth.getUser()!.id!; | |
if (!userId) { | |
return { | |
plan: SubscriptionPlan.FREE, | |
teamPlan: SubscriptionPlan.FREE, | |
}; | |
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If there is no userId, for example when user is signed out, I getting a graphql error.
closes #690
Important
don't forget to setup
NEXT_PUBLIC_NHOST_SUBDOMAIN
andNEXT_PUBLIC_NHOST_REGION
env variables!reactflow.com
UserProvider
(I previously proposed it)NhostClient
's storage type changed tocookie
so we can authenticate in RSC too/dashboard/...
will redirect to/signin
(when NOT authenticated)(auth)
will redirect to/dashboard
(when authenticated)/dashboard
Updated
No need to refactor everything to server actions (or did I miss something?)Let’s combine Sign In and Sign Out into 1 button? it takes up a lot of space in the header