import { IModel , IHubRequestOptions , mapBy , getWithDefault , failSafe } from "@esri/hub-common" ; import { unlinkSiteAndPage } from "./unlink-site-and-page" ; param { Object } siteModel param { IRequestOptions } requestOptions export function unlinkPagesFromSite ( siteModel , requestOptions ) { const linkedPages = mapBy ( "id" , getWithDefault ( siteModel , "data.values.pages" , [ ] ) ) ; const failSafeUnlink = failSafe ( unlinkSiteAndPage ) ; return Promise . all ( linkedPages . map ( ( pageId ) => { const opts = Object . assign ( { siteModel , pageId } , requestOptions ) ; return failSafeUnlink ( opts ) ; } ) ) ; }