2
0

chore(viewer): 🛂 Dynamically parse the viewer api host

This commit is contained in:
Baptiste Arnaud
2022-02-10 14:31:44 +01:00
parent 0338acae82
commit cfbf3d4c0d
4 changed files with 61 additions and 45 deletions

View File

@ -3,6 +3,7 @@ import React, { createContext, ReactNode, useContext, useState } from 'react'
const typebotContext = createContext<{
typebot: PublicTypebot
apiHost: string
updateVariableValue: (variableId: string, value: string) => void
createEdge: (edge: Edge) => void
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
@ -12,9 +13,11 @@ const typebotContext = createContext<{
export const TypebotContext = ({
children,
typebot,
apiHost,
}: {
children: ReactNode
typebot: PublicTypebot
apiHost: string
}) => {
const [localTypebot, setLocalTypebot] = useState<PublicTypebot>(typebot)
@ -38,6 +41,7 @@ export const TypebotContext = ({
<typebotContext.Provider
value={{
typebot: localTypebot,
apiHost,
updateVariableValue,
createEdge,
}}