-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
7f82604
commit 1bcc8ae
Showing
1 changed file
with
42 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
import { getSession } from 'next-auth/react' | ||
import { NextPageContext } from 'next' | ||
import { User } from 'db' | ||
import { isNotDefined } from 'utils' | ||
import { sign } from 'jsonwebtoken' | ||
|
||
const FeedbackPage = () => { | ||
return | ||
} | ||
|
||
export async function getServerSideProps(context: NextPageContext) { | ||
const session = await getSession(context) | ||
const feedbackId = context.query.feedbackId?.toString() as string | ||
if (isNotDefined(session?.user)) | ||
return { | ||
redirect: { | ||
permanent: false, | ||
destination: `/signin?redirectPath=%2Ffeedback%2F${feedbackId}`, | ||
}, | ||
} | ||
const sleekplanToken = createSSOToken(session?.user as User) | ||
return { | ||
redirect: { | ||
permanent: false, | ||
destination: `https://feedback.typebot.io/feedback/${feedbackId}/?sso=${sleekplanToken}`, | ||
}, | ||
} | ||
} | ||
|
||
const createSSOToken = (user: User) => { | ||
if (!process.env.SLEEKPLAN_SSO_KEY) return | ||
const userData = { | ||
mail: user.email, | ||
id: user.id, | ||
name: user.name, | ||
img: user.image, | ||
} | ||
|
||
return sign(userData, process.env.SLEEKPLAN_SSO_KEY, { algorithm: 'HS256' }) | ||
} | ||
|
||
export default FeedbackPage |
1bcc8ae
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.
Successfully deployed to the following URLs:
viewer-v2 – ./apps/viewer
app.yvon.earth
demo.wemakebots.xyz
bot.contakit.com
chat.hayuri.id
bot.matthesv.de
viewer.typebot.io
zap.fundviser.in
92109660.therpm.club
chat.matthesv.de
88584434.therpm.club
bot.digitalpointer.id
bot.outstandbrand.com
criar.somaperuzzo.com
bot.pratikmandalia.com
typebot-viewer.vercel.app
link.venturasuceder.com
chat.thehomebuyersusa.com
invite.bridesquadapp.com
chat.atlasoutfittersk9.com
bot.adventureconsulting.hu
tarian.theiofoundation.org
viewer-v2-typebot-io.vercel.app
bot.pinpointinteractive.com
viewer-v2-git-main-typebot-io.vercel.app
1bcc8ae
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.
Successfully deployed to the following URLs:
builder-v2 – ./apps/builder
builder-v2-git-main-typebot-io.vercel.app
builder-v2-typebot-io.vercel.app
app.typebot.io