fix(core): session exporting while on default dc

This commit is contained in:
alina 🌸 2023-12-04 16:28:25 +03:00
parent 465da7aa9d
commit e42a73fd07
Signed by: teidesu
SSH key fingerprint: SHA256:uNeCpw6aTSU4aIObXLvHfLkDa82HWH9EiOj9AXOIRpI

View file

@ -579,8 +579,7 @@ export class BaseTelegramClient extends EventEmitter {
* > with [@BotFather](//t.me/botfather)
*/
async exportSession(): Promise<string> {
const primaryDcs = await this.storage.getDefaultDcs()
if (!primaryDcs) throw new Error('No default DC set')
const primaryDcs = (await this.storage.getDefaultDcs()) ?? this._defaultDcs
const authKey = await this.storage.getAuthKeyFor(primaryDcs.main.id)
if (!authKey) throw new Error('Auth key is not ready yet')