CondoWebAppUpdateModalWindow

This method updates a modal window previously opened using the CondoWebAppShowModalWindow method.

Platforms

  • B2B-Web

Method params

Parameter nameParameter typeRequiredParameter description
modalIdstringyesID of the modal window to be updated
dataJSONyesJSON containing parameters to be changed and their new values. Any window parameters described in the CondoWebAppShowModalWindow method can be changed, except for the link to the internal iframe (For this you can simply redirect the user inside the already opened iframe).

Return value

If successful, the method will return a JSON object containing a single updated field:
json
{ "updated": true }

Usage examples

Below is an example of updating a modal window from the main page of a mini-application and from modal window iframe :
typescript
// pages/index.tsx import React, { useCallback, useState, useEffect } from 'react' import bridge from '@open-condo/bridge' import { Button } from '@open-condo/ui' export default function MiniappPage (): React.ReactNode { const [openModalId, setOpenModalId] = useState<string | null>(null) const openModal = useCallback(() => { bridge.send('CondoWebAppShowModalWindow', { url: 'http://localhost:3001/modal', size: 'small', title: 'Loading...', }).then((data) => { setOpenModalId(data.modalId) }) }, []) useEffect(() => { if (openModalId) { setTimeout(() => { bridge.send('CondoWebAppUpdateModalWindow', { modalId: openModalId, data: { title: 'Welcome' } }) }, 1000) } }, [openModalId]) return ( <Button type='primary' onClick={openModal}>Open modal window</Button> ) }