mirror of https://github.com/elk-zone/elk.git
66 lines
1.5 KiB
TypeScript
66 lines
1.5 KiB
TypeScript
import { withoutProtocol } from 'ufo'
|
|
import type { Account, Status } from 'masto'
|
|
|
|
export function getAccountRoute(account: Account) {
|
|
return useRouter().resolve({
|
|
name: 'account-index',
|
|
params: {
|
|
server: currentServer.value,
|
|
account: extractAccountHandle(account),
|
|
},
|
|
})
|
|
}
|
|
export function getAccountFollowingRoute(account: Account) {
|
|
return useRouter().resolve({
|
|
name: 'account-following',
|
|
params: {
|
|
server: currentServer.value,
|
|
account: extractAccountHandle(account),
|
|
},
|
|
})
|
|
}
|
|
export function getAccountFollowersRoute(account: Account) {
|
|
return useRouter().resolve({
|
|
name: 'account-followers',
|
|
params: {
|
|
server: currentServer.value,
|
|
account: extractAccountHandle(account),
|
|
},
|
|
})
|
|
}
|
|
|
|
export function getStatusRoute(status: Status) {
|
|
return useRouter().resolve({
|
|
name: 'status',
|
|
params: {
|
|
server: currentServer.value,
|
|
account: extractAccountHandle(status.account),
|
|
status: status.id,
|
|
},
|
|
})
|
|
}
|
|
|
|
export function getTagRoute(tag: string) {
|
|
return useRouter().resolve({
|
|
name: 'tag',
|
|
params: {
|
|
server: currentServer.value,
|
|
tag,
|
|
},
|
|
})
|
|
}
|
|
|
|
export function getStatusPermalinkRoute(status: Status) {
|
|
return status.url ? withoutProtocol(status.url) : null
|
|
}
|
|
|
|
export function getStatusInReplyToRoute(status: Status) {
|
|
return useRouter().resolve({
|
|
name: 'status-by-id',
|
|
params: {
|
|
server: currentServer.value,
|
|
status: status.inReplyToId,
|
|
},
|
|
})
|
|
}
|