Update: Docker dev + logout on frontend

This commit is contained in:
Yûki VACHOT 2022-01-15 18:59:28 +01:00
parent 03fbbb4114
commit 0d6fde6aba
4 changed files with 15 additions and 6 deletions

View file

@ -57,9 +57,9 @@ services:
frontend:
container_name: frontend
build: ./frontend
command: ng serve --host 0.0.0.0
command: npm start
volumes:
- ./frontend/src:/data/frontend/
- ./frontend:/data/frontend
- ./frontend/node_modules:/data/frontend/node_modules
ports:
- "4200:4200"

View file

@ -1,6 +1,6 @@
FROM node:current-alpine
FROM node:current-slim
WORKDIR /data/frontend
COPY ["package.json", "package-lock.json*", "./"]
COPY . .
RUN npm install --NODE_ENV
RUN npm install -g @angular/cli
COPY . .

View file

@ -3,7 +3,7 @@
"version": "0.0.0",
"scripts": {
"ng": "ng",
"start": "ng serve",
"start": "ng serve --host 0.0.0.0",
"build": "ng build",
"watch": "ng build --watch --configuration development",
"test": "ng test"

View file

@ -1,5 +1,6 @@
import {Component, Input, OnInit} from '@angular/core';
import {ProfilService} from "../../services/profil/profil.service";
import {MessageService} from "../../services/message/message.service";
@Component({
selector: 'app-navbar',
@ -10,14 +11,22 @@ export class NavbarComponent implements OnInit
{
@Input() pour = "login";
constructor(private profilService: ProfilService) { }
constructor(private profilService: ProfilService, private messageService: MessageService) { }
ngOnInit(): void {}
onDeconnexion(): void
{
this.messageService
.delete('logout')
.subscribe(retour => this.onDeconnexionCallback(retour), err => this.onDeconnexionCallback(err));
this.profilService.setId(-1);
this.profilService.setIsAdmin(false);
}
onDeconnexionCallback(retour: any): void
{
if(retour.status !== "success") console.log(retour);
}
}