feat: hover card for content @
This commit is contained in:
parent
66393cd838
commit
2becb254b4
8 changed files with 61 additions and 27 deletions
|
@ -28,7 +28,7 @@ export function fetchStatus(id: string): Promise<Status> {
|
|||
return promise
|
||||
}
|
||||
|
||||
export function fetchAccount(id: string): Promise<Account> {
|
||||
export function fetchAccountById(id: string): Promise<Account> {
|
||||
const key = `account:${id}`
|
||||
const cached = cache.get(key)
|
||||
if (cached)
|
||||
|
@ -42,7 +42,7 @@ export function fetchAccount(id: string): Promise<Account> {
|
|||
return promise
|
||||
}
|
||||
|
||||
export async function fetchAccountByName(acct: string): Promise<Account> {
|
||||
export async function fetchAccountByHandle(acct: string): Promise<Account> {
|
||||
const key = `account:${acct}`
|
||||
const cached = cache.get(key)
|
||||
if (cached)
|
||||
|
@ -56,6 +56,14 @@ export async function fetchAccountByName(acct: string): Promise<Account> {
|
|||
return account
|
||||
}
|
||||
|
||||
export function useAccountByHandle(acct: string) {
|
||||
return useAsyncState(() => fetchAccountByHandle(acct), null).state
|
||||
}
|
||||
|
||||
export function useAccountById(id: string) {
|
||||
return useAsyncState(() => fetchAccountById(id), null).state
|
||||
}
|
||||
|
||||
export function cacheStatus(status: Status, override?: boolean) {
|
||||
setCached(`status:${status.id}`, status, override)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue