diff --git a/front/src/app/core/http/message.service.ts b/front/src/app/core/http/message.service.ts index 555e7cd9..5a38d5f0 100644 --- a/front/src/app/core/http/message.service.ts +++ b/front/src/app/core/http/message.service.ts @@ -13,9 +13,9 @@ export class MessageService { constructor(private http: HttpClient) { } - getMessages(): Observable { + getMessages(): Observable { const url = `${environment.apiUrl}/api/messages`; - return this.http.get(url, HTTP_OPTIONS); + return this.http.get(url, HTTP_OPTIONS); } getCurrentMessage(): Observable { diff --git a/front/src/app/modules/management/parameters/message/message.component.html b/front/src/app/modules/management/parameters/message/message.component.html index 9e2f915e..f354f8ca 100644 --- a/front/src/app/modules/management/parameters/message/message.component.html +++ b/front/src/app/modules/management/parameters/message/message.component.html @@ -7,14 +7,18 @@ Message Actuel Anciens Messages - + + + {{currentmessage.title}} + -
- {{message.content}} + + No current message + -
- {{message.content}} + Title :{{message.title}}
+ Content :{{message.content}}
diff --git a/front/src/app/modules/management/parameters/message/message.component.ts b/front/src/app/modules/management/parameters/message/message.component.ts index b5a44fe2..660b8d07 100644 --- a/front/src/app/modules/management/parameters/message/message.component.ts +++ b/front/src/app/modules/management/parameters/message/message.component.ts @@ -1,4 +1,9 @@ -import { Component, OnInit } from '@angular/core'; +import { Component, Input, OnInit } from '@angular/core'; +import { Message } from '../../../../core/classes/models/message'; +import { MessageService } from '../../../../core/http/message.service'; +import { Moment } from 'moment'; +import * as moment from 'moment'; +import { Router } from '@angular/router'; @Component({ selector: 'app-message', @@ -7,9 +12,36 @@ import { Component, OnInit } from '@angular/core'; }) export class MessageComponent implements OnInit { - constructor() { } + messages: Message[]; + loading: boolean = false; + currentmessage: Message; + + constructor( + private messageService: MessageService, + ) { } ngOnInit() { + this.getCurrentMessage(); + this.getAllMessages(); + } + + getCurrentMessage() { + this.loading = true; + + this.messageService.getCurrentMessage().subscribe(currentmessage =>{ + this.currentmessage=currentmessage; + + this.loading =false; + }); + } + + getAllMessages(){ + this.loading = true; + this.messageService.getMessages().subscribe(messages =>{ + this.messages = messages; + + this.loading=false; + }) } } diff --git a/front/src/app/modules/management/parameters/parameters.component.css b/front/src/app/modules/management/parameters/parameters.component.css deleted file mode 100644 index e69de29b..00000000 diff --git a/front/src/app/modules/management/parameters/parameters.component.spec.ts b/front/src/app/modules/management/parameters/parameters.component.spec.ts deleted file mode 100644 index 59ba0e2d..00000000 --- a/front/src/app/modules/management/parameters/parameters.component.spec.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; - -import { ParametersComponent } from './parameters.component'; - -describe('ParametersComponent', () => { - let component: ParametersComponent; - let fixture: ComponentFixture; - - beforeEach(async(() => { - TestBed.configureTestingModule({ - declarations: [ ParametersComponent ] - }) - .compileComponents(); - })); - - beforeEach(() => { - fixture = TestBed.createComponent(ParametersComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); - - it('should create', () => { - expect(component).toBeTruthy(); - }); -}); diff --git a/front/src/app/modules/management/parameters/parameters.component.ts b/front/src/app/modules/management/parameters/parameters.component.ts index 4f29831b..44760d6b 100644 --- a/front/src/app/modules/management/parameters/parameters.component.ts +++ b/front/src/app/modules/management/parameters/parameters.component.ts @@ -2,8 +2,7 @@ import { Component, OnInit } from '@angular/core'; @Component({ selector: 'app-parameters', - templateUrl: './parameters.component.html', - styleUrls: ['./parameters.component.css'] + templateUrl: './parameters.component.html' }) export class ParametersComponent implements OnInit {