This commit is contained in:
parent
41aaba2cc7
commit
96593c510b
3 changed files with 39 additions and 17 deletions
|
@ -16,6 +16,7 @@ spec:
|
||||||
containers:
|
containers:
|
||||||
- name: silly-game-frontend
|
- name: silly-game-frontend
|
||||||
image: forgejo.edf-bootstrap.cx.fg1.ffm.osc.live/devfw-cicd/michals-silly-game-frontend:latest
|
image: forgejo.edf-bootstrap.cx.fg1.ffm.osc.live/devfw-cicd/michals-silly-game-frontend:latest
|
||||||
|
imagePullPolicy: Always
|
||||||
ports:
|
ports:
|
||||||
- containerPort: 80
|
- containerPort: 80
|
||||||
|
|
||||||
|
|
32
src/app/invite.service.ts
Normal file
32
src/app/invite.service.ts
Normal file
|
@ -0,0 +1,32 @@
|
||||||
|
import { Injectable } from '@angular/core';
|
||||||
|
import { HttpClient } from '@angular/common/http';
|
||||||
|
import { environment } from '../enviroments/environment';
|
||||||
|
import { LoggerService } from './logger.service';
|
||||||
|
|
||||||
|
@Injectable({ providedIn: 'root' })
|
||||||
|
export class InviteService {
|
||||||
|
|
||||||
|
private apiUrl = environment.apiBaseUrl;
|
||||||
|
|
||||||
|
constructor(private http: HttpClient, private logger: LoggerService) {}
|
||||||
|
|
||||||
|
|
||||||
|
sendInvite(inviteEmail:string, showInvitePopup:boolean) {
|
||||||
|
if (!inviteEmail) return;
|
||||||
|
|
||||||
|
this.logger.log(`Sending invite to ${inviteEmail}`);
|
||||||
|
|
||||||
|
console.log("api: " + this.apiUrl);
|
||||||
|
|
||||||
|
this.http.post(this.apiUrl+'/api/invite', { email: inviteEmail }).subscribe({
|
||||||
|
next: () => {
|
||||||
|
alert('Invite sent!');
|
||||||
|
inviteEmail = '';
|
||||||
|
showInvitePopup = false;
|
||||||
|
},
|
||||||
|
error: () => {
|
||||||
|
alert('Failed to send invite.');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
|
@ -6,6 +6,7 @@ import { HttpClient } from '@angular/common/http';
|
||||||
import { CommonModule } from '@angular/common';
|
import { CommonModule } from '@angular/common';
|
||||||
import { ActivatedRoute, Router, RouterModule } from '@angular/router';
|
import { ActivatedRoute, Router, RouterModule } from '@angular/router';
|
||||||
import { Subscription } from 'rxjs';
|
import { Subscription } from 'rxjs';
|
||||||
|
import { InviteService } from '../invite.service';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-mario',
|
selector: 'app-mario',
|
||||||
|
@ -85,8 +86,8 @@ import { Subscription } from 'rxjs';
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
private jumpService: JumpService,
|
private jumpService: JumpService,
|
||||||
|
private inviteService: InviteService,
|
||||||
private logger: LoggerService,
|
private logger: LoggerService,
|
||||||
private http: HttpClient,
|
|
||||||
private router: Router,
|
private router: Router,
|
||||||
private route: ActivatedRoute
|
private route: ActivatedRoute
|
||||||
) {}
|
) {}
|
||||||
|
@ -236,21 +237,9 @@ import { Subscription } from 'rxjs';
|
||||||
inviteEmail = '';
|
inviteEmail = '';
|
||||||
showInvitePopup = false;
|
showInvitePopup = false;
|
||||||
|
|
||||||
|
|
||||||
sendInvite() {
|
sendInvite() {
|
||||||
if (!this.inviteEmail) return;
|
this.inviteService.sendInvite(this.inviteEmail, this.showInvitePopup);
|
||||||
|
|
||||||
this.logger.log(`Sending invite to ${this.inviteEmail}`);
|
|
||||||
|
|
||||||
this.http.post('/api/invite', { email: this.inviteEmail }).subscribe({
|
|
||||||
next: () => {
|
|
||||||
alert('Invite sent!');
|
|
||||||
this.inviteEmail = '';
|
|
||||||
this.showInvitePopup = false;
|
|
||||||
},
|
|
||||||
error: () => {
|
|
||||||
alert('Failed to send invite.');
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
navigateToSettings(): void {
|
navigateToSettings(): void {
|
||||||
|
|
Loading…
Reference in a new issue