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


TypeScript service.HttpService.post方法代码示例

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


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

示例1: changeSubmitters

 /**
  * Opens a dialog and adds or removes the selected submitters for all given motions.
  *
  * @param motions The motions to add/remove the sumbitters to
  */
 public async changeSubmitters(motions: ViewMotion[]): Promise<void> {
     const title = this.translate.instant(
         'This will add or remove the following submitters for all selected motions:'
     );
     const choices = [this.translate.instant('Add'), this.translate.instant('Remove')];
     const selectedChoice = await this.choiceService.open(title, this.userRepo.getViewModelList(), true, choices);
     if (selectedChoice && selectedChoice.action === choices[0]) {
         const requestData = motions.map(motion => {
             let submitterIds = [...motion.sorted_submitters_id, ...(selectedChoice.items as number[])];
             submitterIds = submitterIds.filter((id, index, self) => self.indexOf(id) === index); // remove duplicates
             return {
                 id: motion.id,
                 submitters: submitterIds
             };
         });
         await this.httpService.post('/rest/motions/motion/manage_multiple_submitters/', { motions: requestData });
     } else if (selectedChoice && selectedChoice.action === choices[1]) {
         const requestData = motions.map(motion => {
             const submitterIdsToRemove = selectedChoice.items as number[];
             const submitterIds = motion.sorted_submitters_id.filter(id => !submitterIdsToRemove.includes(id));
             return {
                 id: motion.id,
                 submitters: submitterIds
             };
         });
         await this.httpService.post('/rest/motions/motion/manage_multiple_submitters/', { motions: requestData });
     }
 }
开发者ID:jwinzer,项目名称:OpenSlides,代码行数:33,代码来源:motion-multiselect.service.ts

示例2: moveToItem

 /**
  * Moves the related agenda items from the motions as childs under a selected (parent) agenda item.
  */
 public async moveToItem(motions: ViewMotion[]): Promise<void> {
     const title = this.translate.instant('This will move all selected motions as childs to:');
     const choices: (Displayable & Identifiable)[] = this.agendaRepo.getViewModelList();
     const selectedChoice = await this.choiceService.open(title, choices);
     if (selectedChoice) {
         const requestData = {
             items: motions.map(motion => motion.agenda_item_id),
             parent_id: selectedChoice.items as number
         };
         await this.httpService.post('/rest/agenda/item/assign/', requestData);
     }
 }
开发者ID:jwinzer,项目名称:OpenSlides,代码行数:15,代码来源:motion-multiselect.service.ts

示例3: setRecommendation

 /**
  * Opens a dialog and sets the recommendation to the users choice for all selected motions.
  *
  * @param motions The motions to change
  */
 public async setRecommendation(motions: ViewMotion[]): Promise<void> {
     const title = this.translate.instant('This will set the following recommendation for all selected motions:');
     const choices = this.workflowRepo
         .getWorkflowStatesForMotions(motions)
         .filter(workflowState => !!workflowState.recommendation_label)
         .map(workflowState => ({
             id: workflowState.id,
             label: workflowState.recommendation_label
         }));
     const clearChoice = this.translate.instant('Delete recommendation');
     const selectedChoice = await this.choiceService.open(title, choices, false, null, clearChoice);
     if (selectedChoice) {
         const requestData = motions.map(motion => ({
             id: motion.id,
             recommendation: selectedChoice.action ? 0 : (selectedChoice.items as number)
         }));
         await this.httpService.post('/rest/motions/motion/manage_multiple_recommendation/', {
             motions: requestData
         });
     }
 }
开发者ID:jwinzer,项目名称:OpenSlides,代码行数:26,代码来源:motion-multiselect.service.ts

示例4: resetPassword

    /**
     * Do the password reset.
     */
    public async resetPassword(): Promise<void> {
        if (this.resetPasswordForm.invalid) {
            return;
        }

        try {
            await this.http.post<void>(environment.urlPrefix + '/users/reset-password/', {
                email: this.resetPasswordForm.get('email').value
            });
            // TODO: Does we get a response for displaying?
            this.matSnackBar.open(
                this.translate.instant('An email with a password reset link was send!'),
                this.translate.instant('OK'),
                {
                    duration: 0
                }
            );
            this.router.navigate(['/login']);
        } catch (e) {
            console.log('error', e);
        }
    }
开发者ID:CatoTH,项目名称:OpenSlides,代码行数:25,代码来源:reset-password.component.ts

示例5: submitNewPassword

    /**
     * Submit the new password.
     */
    public async submitNewPassword(): Promise<void> {
        if (this.newPasswordForm.invalid) {
            return;
        }

        try {
            await this.http.post<void>(environment.urlPrefix + '/users/reset-password-confirm/', {
                user_id: this.user_id,
                token: this.token,
                password: this.newPasswordForm.get('password').value
            });
            // TODO: Does we get a response for displaying?
            this.matSnackBar.open(
                this.translate.instant('Your password was resetted successfully!'),
                this.translate.instant('OK'),
                {
                    duration: 0
                }
            );
            this.router.navigate(['/login']);
        } catch (e) {
            console.log('error', e);
        }
    }
开发者ID:CatoTH,项目名称:OpenSlides,代码行数:27,代码来源:reset-password-confirm.component.ts

示例6: create

 /**
  * Add a new speaker to an agenda item.
  * Sends the users ID to the server
  * Might need another repo
  *
  * @param speakerId {@link User} id of the new speaker
  * @param item the target agenda item
  */
 public async create(speakerId: number, item: ViewItem): Promise<void> {
     const restUrl = this.getRestUrl(item.id, 'manage_speaker');
     await this.httpService.post<Identifiable>(restUrl, { user: speakerId });
 }
开发者ID:FinnStutzenstein,项目名称:OpenSlides,代码行数:12,代码来源:speaker-repository.service.ts

示例7: sortSpeakers

 /**
  * Posts an (manually) sorted speaker list to the server
  *
  * @param speakerIds array of speaker id numbers
  * @param Item the target agenda item
  */
 public async sortSpeakers(speakerIds: number[], item: Item): Promise<void> {
     const restUrl = this.getRestUrl(item.id, 'sort_speakers');
     await this.httpService.post(restUrl, { speakers: speakerIds });
 }
开发者ID:FinnStutzenstein,项目名称:OpenSlides,代码行数:10,代码来源:speaker-repository.service.ts


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