refactor: inject masto instance via nuxt app (#134)
This commit is contained in:
parent
5c60497421
commit
39b005899e
26 changed files with 67 additions and 48 deletions
|
@ -19,7 +19,7 @@ export function fetchStatus(id: string): Promise<Status> {
|
|||
const cached = cache.get(key)
|
||||
if (cached)
|
||||
return cached
|
||||
const promise = masto.statuses.fetch(id)
|
||||
const promise = useMasto().statuses.fetch(id)
|
||||
.then((status) => {
|
||||
cacheStatus(status)
|
||||
return status
|
||||
|
@ -33,7 +33,7 @@ export function fetchAccount(id: string): Promise<Account> {
|
|||
const cached = cache.get(key)
|
||||
if (cached)
|
||||
return cached
|
||||
const promise = masto.accounts.fetch(id)
|
||||
const promise = useMasto().accounts.fetch(id)
|
||||
.then((account) => {
|
||||
cacheAccount(account, true)
|
||||
return account
|
||||
|
@ -47,7 +47,7 @@ export async function fetchAccountByName(acct: string): Promise<Account> {
|
|||
const cached = cache.get(key)
|
||||
if (cached)
|
||||
return cached
|
||||
const account = masto.accounts.lookup({ acct })
|
||||
const account = useMasto().accounts.lookup({ acct })
|
||||
.then((r) => {
|
||||
cacheAccount(r, true)
|
||||
return r
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue