mirror of
https://github.com/frappe/books.git
synced 2024-12-23 03:19:01 +00:00
de7e5ba807
- cause now most of it is different from what it was
23 lines
672 B
TypeScript
23 lines
672 B
TypeScript
import { ipcRenderer } from 'electron';
|
|
import { AuthDemuxBase, TelemetryCreds } from 'utils/auth/types';
|
|
import { IPC_ACTIONS } from 'utils/messages';
|
|
|
|
export class AuthDemux extends AuthDemuxBase {
|
|
#isElectron: boolean = false;
|
|
constructor(isElectron: boolean) {
|
|
super();
|
|
this.#isElectron = isElectron;
|
|
}
|
|
|
|
async getTelemetryCreds(): Promise<TelemetryCreds> {
|
|
if (this.#isElectron) {
|
|
const creds = await ipcRenderer.invoke(IPC_ACTIONS.GET_CREDS);
|
|
const url: string = creds?.telemetryUrl ?? '';
|
|
const token: string = creds?.tokenString ?? '';
|
|
return { url, token };
|
|
} else {
|
|
return { url: '', token: '' };
|
|
}
|
|
}
|
|
}
|