Skip to content

Commit

Permalink
fix: widget redirection (#682)
Browse files Browse the repository at this point in the history
  • Loading branch information
kevbarns authored Oct 12, 2023
1 parent cbff022 commit fd1595e
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion ui/components/espace_pro/ConfirmationCreationCompte.tsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
import { Box, Button, Center, Heading, Modal, ModalBody, ModalContent, ModalFooter, ModalHeader, ModalOverlay, Stack, Text } from "@chakra-ui/react"
import { useRouter } from "next/router"
import { useContext } from "react"

import { AUTHTYPE } from "../../common/contants"
import { redirect } from "../../common/utils/router"
import { WidgetContext } from "../../context/contextWidget"
import { InfoCircle } from "../../theme/components/icons"
import { deleteCfa, deleteEntreprise } from "../../utils/api"

export const ConfirmationCreationCompte = (props) => {
const { isOpen, onClose, user, formulaire } = props
const router = useRouter()
const { widget } = useContext(WidgetContext)

const validateAccountCreation = () => {
switch (user.type) {
Expand All @@ -34,7 +37,11 @@ export const ConfirmationCreationCompte = (props) => {
} else {
await deleteCfa(user._id)
}
redirect("/", true)
if (widget.isWidget) {
redirect(`/espace-pro/widget/${formulaire.origin}`, true)
} else {
redirect("/", true)
}
}

return (
Expand Down

0 comments on commit fd1595e

Please sign in to comment.