【发布时间】:2018-11-17 03:21:53
【问题描述】:
我有一个需要从 Angular 服务执行的云功能,该服务在单击按钮时运行。我一直在尝试向它发出 HTTP POST 请求并发送我的数据,但无济于事。我已经解决了它给我的所有错误,但现在它什么也没做......
HTTP云函数
exports.recurringPayment = functions.https.onRequest((req, res) => {
console.log('Cloud Function running');
res.status(200).send('Done');
}
角度服务
recurringPaymentURL = 'https://recurringpaymenturl.com';
data;
newPost: Observable<any>;
constructor(public http: HttpClient){}
processPayment(user, token){
this.data = {
id: 123,
userID: 23,
title: 'Some title',
body: 'Some body'
}
//Invoke https function with POST
this.newPost = this.http.post(this.recurringPaymentURL, this.data);
}
【问题讨论】:
标签: node.js angular firebase stripe-payments google-cloud-functions