当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript ApiRoot.getDefaultRequestOptions方法代码示例

本文整理汇总了TypeScript中dotcms-js.ApiRoot.getDefaultRequestOptions方法的典型用法代码示例。如果您正苦于以下问题:TypeScript ApiRoot.getDefaultRequestOptions方法的具体用法?TypeScript ApiRoot.getDefaultRequestOptions怎么用?TypeScript ApiRoot.getDefaultRequestOptions使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在dotcms-js.ApiRoot的用法示例。


在下文中一共展示了ApiRoot.getDefaultRequestOptions方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。

示例1: remove

 remove(model: ConditionModel): Observable<ConditionModel> {
     const opts = this._apiRoot.getDefaultRequestOptions();
     const remove = this._http
         .delete(this._baseUrl + '/' + model.key, opts).pipe(
         map((_res: Response) => {
             return model;
         }));
     return remove.pipe(catchError(this._catchRequestError('remove')));
 }
开发者ID:dotCMS,项目名称:core-web,代码行数:9,代码来源:Condition.ts

示例2: add

 add(groupId: string, model: ConditionModel): Observable<any> {
     // this.loggerService.info("api.rule-engine.ConditionService", "add", model)
     if (!model.isValid()) {
         throw new Error(`This should be thrown from a checkValid function on the model,
                     and should provide the info needed to make the user aware of the fix.`);
     }
     const json = ConditionService.toJson(model);
     json.owningGroup = groupId;
     const opts = this._apiRoot.getDefaultRequestOptions();
     const add = this._http
         .post(this._baseUrl + '/', JSON.stringify(json), opts).pipe(
         map((res: Response) => {
             const json = res.json();
             model.key = json.id;
             return model;
         }));
     return add.pipe(catchError(this._catchRequestError('add')));
 }
开发者ID:dotCMS,项目名称:core-web,代码行数:18,代码来源:Condition.ts

示例3: save

 save(groupId: string, model: ConditionModel): Observable<ConditionModel> {
     this.loggerService.info('api.rule-engine.ConditionService', 'save', model);
     if (!model.isValid()) {
         throw new Error(`This should be thrown from a checkValid function on the model,
                     and should provide the info needed to make the user aware of the fix.`);
     }
     if (!model.isPersisted()) {
         this.add(groupId, model);
     } else {
         const json = ConditionService.toJson(model);
         json.owningGroup = groupId;
         const opts = this._apiRoot.getDefaultRequestOptions();
         const body = JSON.stringify(json);
         const save = this._http
             .put(this._baseUrl + '/' + model.key, body, opts).pipe(
             map((_res: Response) => {
                 return model;
             }));
         return save.pipe(catchError(this._catchRequestError('save')));
     }
 }
开发者ID:dotCMS,项目名称:core-web,代码行数:21,代码来源:Condition.ts

示例4: makeRequest

 makeRequest(childPath: string): Observable<any> {
     const opts = this._apiRoot.getDefaultRequestOptions();
     return this._http
         .get(this._baseUrl + '/' + childPath, opts).pipe(
         map((res: Response) => {
             return res.json();
         }),
         catchError((err: any, _source: Observable<any>) => {
             if (err && err.status === HttpCode.NOT_FOUND) {
                 this.loggerService.info('Could not retrieve Condition Types: URL not valid.');
             } else if (err) {
                 this.loggerService.info(
                     'Could not retrieve Condition Types.',
                     'response status code: ',
                     err.status,
                     'error:',
                     err
                 );
             }
             return observableEmpty();
         }),);
 }
开发者ID:dotCMS,项目名称:core-web,代码行数:22,代码来源:Condition.ts


注:本文中的dotcms-js.ApiRoot.getDefaultRequestOptions方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。