Skip to content

Commit

Permalink
del auth on disconnect
Browse files Browse the repository at this point in the history
  • Loading branch information
XueMoMo committed Oct 25, 2024
1 parent dd81f2b commit 2997ca8
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
1 change: 1 addition & 0 deletions src/commands-handlers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,7 @@ export async function handleDisconnectCommand(msg: TelegramBot.Message): Promise
}

await connector.disconnect();
await setAuth(chatId, null);

await bot.sendMessage(chatId, 'Wallet has been disconnected');
}
Expand Down
8 changes: 6 additions & 2 deletions src/ton-connect/storage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,12 @@ export async function setMode(chatId: number, mode: MODE): Promise<void> {
await client.set(`storage_mode_${chatId}`, mode);
}

export async function setAuth(chatId: number, auth: string) {
await client.set(`auth_${chatId}`, auth);
export async function setAuth(chatId: number, auth?: string | null) {
if (!auth) {
await client.del(`auth_${chatId}`);
} else {
await client.set(`auth_${chatId}`, auth);
}
}

export async function getAuth(chatId: number) {
Expand Down

0 comments on commit 2997ca8

Please sign in to comment.