From 154898b0b7bc1af41fc5a94974e338a3590c90f3 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Sat, 17 Jun 2017 11:28:11 +0200 Subject: Share models between server and client --- client/src/app/core/auth/auth.service.ts | 5 +++-- client/src/app/core/config/config.service.ts | 7 ++----- 2 files changed, 5 insertions(+), 7 deletions(-) (limited to 'client/src/app/core') diff --git a/client/src/app/core/auth/auth.service.ts b/client/src/app/core/auth/auth.service.ts index 32f7a5503..fcc6b9bb6 100644 --- a/client/src/app/core/auth/auth.service.ts +++ b/client/src/app/core/auth/auth.service.ts @@ -11,6 +11,7 @@ import { NotificationsService } from 'angular2-notifications' import { AuthStatus } from './auth-status.model' import { AuthUser } from './auth-user.model' +import { ClientLocal } from '../../../../../shared' // Do not use the barrel (dependency loop) import { RestExtractor } from '../../shared/rest' @@ -40,9 +41,9 @@ export class AuthService { // FIXME: save in local storage? this.http.get(AuthService.BASE_CLIENT_URL) .map(this.restExtractor.extractDataGet) - .catch((res) => this.restExtractor.handleError(res)) + .catch(res => this.restExtractor.handleError(res)) .subscribe( - result => { + (result: ClientLocal) => { this.clientId = result.client_id this.clientSecret = result.client_secret console.log('Client credentials loaded.') diff --git a/client/src/app/core/config/config.service.ts b/client/src/app/core/config/config.service.ts index a83ec61d2..b8cb15e84 100644 --- a/client/src/app/core/config/config.service.ts +++ b/client/src/app/core/config/config.service.ts @@ -2,16 +2,13 @@ import { Injectable } from '@angular/core' import { Http } from '@angular/http' import { RestExtractor } from '../../shared/rest' +import { ServerConfig } from '../../../../../shared' @Injectable() export class ConfigService { private static BASE_CONFIG_URL = API_URL + '/api/v1/config/' - private config: { - signup: { - enabled: boolean - } - } = { + private config: ServerConfig = { signup: { enabled: false } -- cgit v1.2.3