Sharkey/packages/frontend/src/scripts/get-account-from-id.ts

13 lines
405 B
TypeScript
Raw Normal View History

/*
* SPDX-FileCopyrightText: syuilo and other misskey contributors
* SPDX-License-Identifier: AGPL-3.0-only
*/
2023-09-19 10:37:43 +03:00
import { get } from '@/scripts/idb-proxy.js';
export async function getAccountFromId(id: string) {
const accounts = await get('accounts') as { token: string; id: string; }[];
if (!accounts) console.log('Accounts are not recorded');
return accounts.find(account => account.id === id);
}