import { useDatabase } from "@/app/providers/DatabaseProvider/useDatabase"; import { UserInformation } from "./InformationProvider"; import { OnlineState } from "../ProtocolProvider/protocol/packets/packet.onlinestate"; export function useUserCacheFunc() { const {getQuery} = useDatabase(); const getUserInformation = async (publicKey: string): Promise => { const result = await getQuery("SELECT * FROM `cached_users` WHERE `public_key` = ?", [publicKey]); if(!result){ return null; } return { publicKey: result.public_key, verified: result.verified, title: result.title, username: result.username, online: OnlineState.OFFLINE }; } return getUserInformation; }