在 ionic 4 项目中使用 OneSignal Api

using OneSignal Api in ionic 4 project

我正在尝试使用来自 ionic 4 的 post 请求创建推送通知,使用 one signal

这是我发送 POST 请求的方式:

    async presentAlertMultipleButtons() {
        const alert = await this.alertController.create({
            header: 'Confirm',
            subHeader: 'Your dress is added',
            message: 'Admin team will review the dress and post it as soon as possible.',
            buttons: ['Ok'],
            mode: 'ios'
        });

        await alert.present();
        const post_data = {
            'app_id': 'xxxxxxxxxxxxxxxxxxxxxx',
            'contents': {
                'en': 'new dress added to fostania'
            },
            'headings': {
                'en': 'new dress'
            },
            'included_segments': ['admins'],
        }
        const httpOptions2 = {
            headers: new HttpHeaders({
                'Content-Type': 'application/json',
                'Authorization': 'Basic xxxxxxxxxxxxxxxxxxxxxxxxx'
            })
        };
        this.httpClient.post('https://onesignal.com/api/v1/notifications', post_data, httpOptions2);

        this.router.navigate(['/list']);
    }

我在向用户显示操作已完成的通知(警告)后添加了 post。

而且没有发送,甚至根本没有任何响应!

感谢@R.Richards 的评论。

我变了 this.httpClient.post('https://onesignal.com/api/v1/notifications', post_data, httpOptions2);

this.httpClient.post('https://onesignal.com/api/v1/notifications', post_data, httpOptions2)
                        .subscribe(new_data => {
                            console.log(new_data)
                        }, error => {
                            console.log(error);
                        });

现在可以使用了