Make subscription work

This commit is contained in:
2026-05-04 23:55:41 +02:00
parent 141618f2cd
commit 54bae3e9c9
8 changed files with 41 additions and 23 deletions

View File

@@ -511,15 +511,21 @@ export default {
}).text(asInfo.lat_dms+' '+asInfo.lon_dms);
},
async manageSubs() {
if(this.nlLoading) return;
var regexEmail = /^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
if(!regexEmail.test(this.user.email)) this.nlFeedbacks.push({type:'error', 'msg':this.lang.get('newsletter.invalid_email')});
else {
this.api.get(this.nlAction, {'email': this.user.email, 'name': this.user.name})
.then((asUser, sDesc) => {
this.nlFeedbacks.push('success', sDesc);
Object.assign(this.user, asUser);
const sAction = this.nlAction;
this.nlLoading = true;
this.api.request(sAction, {'email': this.user.email, 'name': this.user.name})
.then((asResponse) => {
this.nlFeedbacks.push({type: asResponse.result, msg: asResponse.desc});
this.user.setInfo(asResponse.data);
})
.catch((sDesc) => {this.nlFeedbacks.push('error', sDesc);});
.catch((sDesc) => {this.nlFeedbacks.push({type:'error', msg:sDesc?.message || sDesc});})
.finally(() => {this.nlLoading = false;});
}
},
toggleFeedPanel(bShow, sMapAction) {