Files
start-os/frontend/projects/setup-wizard/src/app/services/state.service.ts
Alex Inkin 3804a46f3b refactor: extract loading status to shared library (#2282)
* refactor: extract loading status to shared library

* chore: remove inline style
2023-07-06 15:11:13 -06:00

36 lines
952 B
TypeScript

import { Injectable } from '@angular/core'
import { ApiService, RecoverySource } from './api/api.service'
@Injectable({
providedIn: 'root',
})
export class StateService {
setupType?: 'fresh' | 'restore' | 'attach' | 'transfer'
recoverySource?: RecoverySource
recoveryPassword?: string
constructor(private readonly api: ApiService) {}
async importDrive(guid: string, password: string): Promise<void> {
await this.api.attach({
guid,
'embassy-password': await this.api.encrypt(password),
})
}
async setupEmbassy(
storageLogicalname: string,
password: string,
): Promise<void> {
await this.api.execute({
'embassy-logicalname': storageLogicalname,
'embassy-password': await this.api.encrypt(password),
'recovery-source': this.recoverySource || null,
'recovery-password': this.recoveryPassword
? await this.api.encrypt(this.recoveryPassword)
: null,
})
}
}