Skip to content

Commit

Permalink
🐛 (auth) Fix redirect URL after sign in
Browse files Browse the repository at this point in the history
  • Loading branch information
baptisteArno committed Aug 11, 2023
1 parent 0078d6d commit d31500e
Showing 1 changed file with 6 additions and 12 deletions.
18 changes: 6 additions & 12 deletions apps/builder/src/features/account/UserProvider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,26 +37,20 @@ export const UserProvider = ({ children }: { children: ReactNode }) => {
const parsedUser = session.user as User
setUser(parsedUser)
if (parsedUser?.id) setSentryUser({ id: parsedUser.id })
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [session])
}, [session, user])

useEffect(() => {
if (!router.isReady) return
if (status === 'loading') return
const isSigningIn = () => ['/signin', '/register'].includes(router.pathname)
if (!user && status === 'unauthenticated' && !isSigningIn())
router.replace({
pathname: '/signin',
query:
router.pathname !== '/typebots'
? {
redirectPath: router.asPath,
}
: undefined,
query: {
redirectPath: router.asPath,
},
})
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [status, router])

const isSigningIn = () => ['/signin', '/register'].includes(router.pathname)
}, [router, status, user])

const updateUser = (updates: Partial<User>) => {
if (isNotDefined(user)) return
Expand Down

4 comments on commit d31500e

@vercel
Copy link

@vercel vercel bot commented on d31500e Aug 11, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vercel
Copy link

@vercel vercel bot commented on d31500e Aug 11, 2023

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
app.typebot.io
builder-v2-typebot-io.vercel.app

@vercel
Copy link

@vercel vercel bot commented on d31500e Aug 11, 2023

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:

docs – ./apps/docs

docs.typebot.io
docs-git-main-typebot-io.vercel.app
docs-typebot-io.vercel.app

@vercel
Copy link

@vercel vercel bot commented on d31500e Aug 11, 2023

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

bii.bj
1stop.au
wasap.nl
x.cr8.ai
yobot.me
klujo.com
me.cr8.ai
wachat.io
wassep.io
247987.com
8jours.top
aginap.com
ai.mprs.in
bee.cr8.ai
bot.aws.bj
bot.bbc.bj
cat.cr8.ai
finplex.be
jxi.cr8.ai
nepkit.com
pig.cr8.ai
sat.cr8.ai
typebot.io
wachats.me
wsapio.com
blogely.com
bot.aipr.kr
bot.kloo.me
broprio.com
bull.cr8.ai
docs.cr8.ai
getyour.sbs
icon.cr8.ai
minipost.uk
mole.cr8.ai
nurraysa.me
team.cr8.ai
wolf.cr8.ai
ai.meant.com
bet7k.online
bot.afric.ai
bot.grace.bj
cinecorn.com
ezbooking.ai
gniorder.com
help.taxt.co
kusamint.com
psmix.online
receita.info
rhino.cr8.ai
sheep.cr8.ai
snake.cr8.ai
tiger.cr8.ai
rossano.thegymgame.it
sbutton.wpwakanda.com
segredosdothreads.com
talk.convobuilder.com
test.leadbooster.help
whats.laracardoso.com
www.acesso-app.online
www.hemertonsilva.com
zillabot.saaszilla.co
815639944.21000000.one
83720273.bouclidom.com
aplicacao.bmind.com.br
apply.ansuraniphone.my
bbutton.wpwwakanda.com
bolsamaisbrasil.app.br
bot.chat-debora.online
bot.clubedotrader.club
bot.louismarcondes.com
bot.perfaceacademy.com
bot.pratikmandalia.com
bot.sucessodigital.xyz
bot.t20worldcup.com.au
bot.whatsappweb.adm.br
bot2.mycompany.reviews
bot3.mycompany.reviews
bot4.mycompany.reviews
c23111azqw.nigerias.io
chat.footballmeetup.ie
conto.barrettamario.it
dieta.barrettamario.it
felipewelington.com.br
form.bridesquadapp.com
form.searchcube.com.sg
go.orodrigoribeiro.com
help.giversforgood.com
info.clickasuransi.com
jenifferrodrigues.club
kodawariab736.skeep.it
mdb.diego.progenbr.com
michaeljackson.riku.ai
premium.kandabrand.com
psicologiacognitiva.co
report.gratirabbit.com
resume.gratirabbit.com
suporte.pedroallan.com
teambuilding.hidden.sg
whatsappwebsite.com.br

Please sign in to comment.