aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/core/config/config.service.ts
blob: 3c479bcb8cc2fdb75a4314e8bc4959a673b060cc (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
import { Injectable } from '@angular/core'
import { HttpClient } from '@angular/common/http'

import { ServerConfig } from '../../../../../shared'

@Injectable()
export class ConfigService {
  private static BASE_CONFIG_URL = API_URL + '/api/v1/config/'

  private config: ServerConfig = {
    signup: {
      allowed: false
    }
  }

  constructor (private http: HttpClient) {}

  loadConfig () {
    this.http.get<ServerConfig>(ConfigService.BASE_CONFIG_URL)
             .subscribe(data => this.config = data)
  }

  getConfig () {
    return this.config
  }
}