This commit is contained in:
Eugene Pankov
2021-07-25 16:36:45 +02:00
parent 6a78032849
commit c8ee6832f3
57 changed files with 53 additions and 1003 deletions

47
frontend/src/api.ts Normal file
View File

@@ -0,0 +1,47 @@
import { HttpClient } from '@angular/common/http'
import { Injectable } from '@angular/core'
import { Resolve } from '@angular/router'
import { Observable } from 'rxjs'
export interface User {
active_config: number
active_version: string
custom_connection_gateway: string|null
custom_connection_gateway_token: string|null
config_sync_token: string
github_username: string
is_pro: boolean
}
export interface Config {
id: number
content: string
last_used_with_version: string
created_at: Date
modified_at: Date
}
export interface Version {
version: string
plugins: string[]
}
export interface InstanceInfo {
login_enabled: boolean
}
export interface Gateway {
host: string
port: number
url: string
auth_token: string
}
@Injectable({ providedIn: 'root' })
export class InstanceInfoResolver implements Resolve<Observable<InstanceInfo>> {
constructor (private http: HttpClient) { }
resolve(): Observable<InstanceInfo> {
return this.http.get('/api/1/instance-info').toPromise()
}
}