diff --git a/front/Dockerfile b/front/Dockerfile index 18eb59e..c9e962e 100644 --- a/front/Dockerfile +++ b/front/Dockerfile @@ -20,7 +20,7 @@ ENV PATH /application/node_modules/.bin:$PATH RUN npm install # generate build -RUN ng build --output-path=dist --configuration=production +RUN ng build --output-path=dist --configuration=production --deploy-url=/karideo/ ############ ### prod ### diff --git a/front/src/app/element-video/element-video.component.ts b/front/src/app/element-video/element-video.component.ts index 1c50bf7..0ceb954 100644 --- a/front/src/app/element-video/element-video.component.ts +++ b/front/src/app/element-video/element-video.component.ts @@ -10,6 +10,7 @@ import { Injectable, Component, OnInit, Input } from '@angular/core'; import { Router } from "@angular/router"; import { ActivatedRoute, Params } from '@angular/router'; import { VideoService } from '../video.service'; +import { HttpWrapperService } from '../http-wrapper.service'; @Component({ selector: 'app-element-video', @@ -37,7 +38,8 @@ export class ElementVideoComponent implements OnInit { video_source:string = "" video_enable:boolean = false; constructor(private router: Router, - private videoService: VideoService) { + private videoService: VideoService, + private httpService: HttpWrapperService) { } ngOnInit() { @@ -57,7 +59,7 @@ export class ElementVideoComponent implements OnInit { self.time = response.time; self.generated_name = response.generated_name; if (self.data_id != -1) { - self.video_source = "http://localhost:15080/data/" + self.data_id; + self.video_source = self.httpService.createRESTCall("data/" + self.data_id); self.video_enable = true; } else { self.video_source = ""; diff --git a/front/src/app/http-wrapper.service.ts b/front/src/app/http-wrapper.service.ts index c8b03a9..0040a4e 100644 --- a/front/src/app/http-wrapper.service.ts +++ b/front/src/app/http-wrapper.service.ts @@ -3,7 +3,7 @@ import { Injectable } from '@angular/core'; import { HttpClient, HttpHeaders } from '@angular/common/http'; import { catchError, map, tap } from 'rxjs/operators'; -import { createRESTCall } from 'environments/environment'; +import { environment } from 'environments/environment'; @Injectable() export class HttpWrapperService { @@ -12,8 +12,29 @@ export class HttpWrapperService { } + createRESTCall(_api:string, _options:any = undefined) { + let basePage = environment.apiUrl; + let addressServerRest = basePage + "/"; + let out; + if (typeof _options === 'undefined') { + _options = []; + } + out = addressServerRest + _api; + let first = true; + for (let iii=0; iii<_options.length; iii++) { + if (first ==false) { + out += "&"; + } else { + out += "?"; + first = false; + } + out += _options[iii]; + } + return out; + } + get(_uriRest:string, _headerOption:any, _params:any) { - let connectionAdresse = createRESTCall(_uriRest, {}); + let connectionAdresse = this.createRESTCall(_uriRest, {}); let config = { params: _params, headers: new HttpHeaders(_headerOption) @@ -49,7 +70,7 @@ export class HttpWrapperService { } post(_uriRest:string, _headerOption:any, _data:any) { - let connectionAdresse = createRESTCall(_uriRest, {}); + let connectionAdresse = this.createRESTCall(_uriRest, {}); const httpOption = { headers: new HttpHeaders(_headerOption) }; diff --git a/front/src/environments/environment.prod.ts b/front/src/environments/environment.prod.ts index d24410e..d120580 100644 --- a/front/src/environments/environment.prod.ts +++ b/front/src/environments/environment.prod.ts @@ -6,29 +6,7 @@ export const environment = { production: false, // URL of development API - apiUrl: 'http://192.168.1.157/karideo/api/', - //apiMode: "QUERRY" - apiMode: "REWRITE" + apiUrl: 'http://192.168.1.157/karideo/api', + apiMode: "QUERRY" + //apiMode: "REWRITE" } - -export let createRESTCall = function(api, options) { - let basePage = environment.apiUrl; - let addressServerRest = basePage + "/"; - let out; - if (typeof options === 'undefined') { - options = []; - } - out = addressServerRest + api; - let first = true; - for (let iii=0; iii