2
0

feat: Add collaboration

This commit is contained in:
Baptiste Arnaud
2022-02-24 11:13:19 +01:00
parent dd671a5d2c
commit b9dafa611e
63 changed files with 1932 additions and 148 deletions

View File

@ -9,7 +9,7 @@ import {
useState,
} from 'react'
import { isDefined, isNotDefined } from 'utils'
import { updateUser as updateUserInDb } from 'services/user'
import { updateUser as updateUserInDb } from 'services/user/user'
import { useToast } from '@chakra-ui/react'
import { deepEqual } from 'fast-equals'
import { User } from 'db'
@ -56,7 +56,15 @@ export const UserContext = ({ children }: { children: ReactNode }) => {
if (!router.isReady) return
if (status === 'loading') return
if (status === 'unauthenticated' && !isSigningIn())
router.replace('/signin')
router.replace({
pathname: '/signin',
query:
router.pathname !== '/typebots'
? {
redirectPath: router.asPath,
}
: undefined,
})
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [status, router])