import { IModel , IHubRequestOptions , getHubApiUrl } from "@esri/hub-common" ; param { Object } siteModel param { IHubRequestOptions } hubRequestOptions private export function _removeSiteFromIndex ( siteModel , hubRequestOptions ) { if ( hubRequestOptions . isPortal ) { return Promise . resolve ( ) ; } else { const url = `${ getHubApiUrl ( hubRequestOptions ) }/api/v3/${ siteModel . item . id }` ; const opts = { method : "DELETE" , mode : "cors" , headers : { Authorization : hubRequestOptions . authentication . token , } , } as RequestInit ; return fetch ( url , opts ) . then ( ( raw ) => raw . json ( ) ) . then ( ( _ ) => { return { success : true } ; } ) . catch ( ( err ) => { throw Error ( `_removeSiteFromIndex: Error removing site from index: ${ err }` ) ; } ) ; } }