Update: Environment for Heroku Production

This commit is contained in:
Yûki VACHOT 2021-12-22 12:15:32 +01:00
parent b7df19e1c0
commit 0d6cca625c
136 changed files with 35 additions and 2784 deletions

View file

@ -0,0 +1,16 @@
import { TestBed } from '@angular/core/testing';
import { MessageService } from './message.service';
describe('MessageService', () => {
let service: MessageService;
beforeEach(() => {
TestBed.configureTestingModule({});
service = TestBed.inject(MessageService);
});
it('should be created', () => {
expect(service).toBeTruthy();
});
});

View file

@ -0,0 +1,38 @@
import { Injectable } from '@angular/core';
import {HttpClient, HttpParams} from "@angular/common/http";
import {Observable} from "rxjs";
import {environment} from "../../../environments/environment";
@Injectable({
providedIn: 'root'
})
export class MessageService
{
constructor( private http: HttpClient ) { }
post(url: string, data: any): Observable<any>
{
const urlComplete = environment.debutUrl + url ;
return this.http.post<any>(urlComplete, data, {withCredentials: true});
}
get(url: string, params:HttpParams = new HttpParams()): Observable<any>
{
const urlComplete = environment.debutUrl + url ;
return this.http.get<any>(urlComplete,{ withCredentials: true, params: params });
}
put(url: string, data: any): Observable<any>
{
const urlComplete = environment.debutUrl + url ;
return this.http.put<any>(urlComplete, data, {withCredentials: true});
}
delete(url: string): Observable<any>
{
const urlComplete = environment.debutUrl + url ;
return this.http.delete<any>(urlComplete,{withCredentials: true});
}
}

View file

@ -0,0 +1,16 @@
import { TestBed } from '@angular/core/testing';
import { ProfilService } from './profil.service';
describe('ProfilService', () => {
let service: ProfilService;
beforeEach(() => {
TestBed.configureTestingModule({});
service = TestBed.inject(ProfilService);
});
it('should be created', () => {
expect(service).toBeTruthy();
});
});

View file

@ -0,0 +1,29 @@
import { Injectable } from '@angular/core';
@Injectable({
providedIn: 'root'
})
export class ProfilService
{
getId(): string
{
return localStorage.getItem('id');
}
getProfileImageUrl(): string
{
return localStorage.getItem('profileImageUrl');
}
setId(id: string): void
{
localStorage.setItem('id', id);
}
setProfileImageUrl(profileImageUrl: string): void
{
localStorage.setItem('profileImageUrl', profileImageUrl);
}
}

View file

@ -0,0 +1,16 @@
import { TestBed } from '@angular/core/testing';
import { ThemeService } from './theme.service';
describe('ThemeService', () => {
let service: ThemeService;
beforeEach(() => {
TestBed.configureTestingModule({});
service = TestBed.inject(ThemeService);
});
it('should be created', () => {
expect(service).toBeTruthy();
});
});

View file

@ -0,0 +1,17 @@
import { Injectable } from '@angular/core';
@Injectable({
providedIn: 'root'
})
export class ThemeService
{
isLightTheme = true;
getClassTheme(): string
{
if(this.isLightTheme) return "lightTheme" ;
else return "darkTheme"
}
}