import { generatePath } from 'react-router-dom' ; import { ENGINE_CRAWLER_PATH , ENGINE_PATH } from '../../routes' ; export const getRedirectToAfterEngineCreation = ( { ingestionMethod , engineName , } ) : string => { if ( ingestionMethod === 'crawler' ) { return generatePath ( ENGINE_CRAWLER_PATH , { engineName } ) ; } let enginePath = generatePath ( ENGINE_PATH , { engineName } ) ; if ( ingestionMethod ) { enginePath += `?method=${ encodeURIComponent ( ingestionMethod ) }` ; } return enginePath ; } ;