feat: switch to a toast
This commit is contained in:
1 parent
0fbe243f7b
commit
45fbc7d25f
1 file changed
+13
-8
@@ -40,15 +40,21 @@
|
|||||||
|
|
||||||
afterNavigate(async () => {
|
afterNavigate(async () => {
|
||||||
// reactivity hack
|
// reactivity hack
|
||||||
|
|
||||||
post = data.post
|
post = data.post
|
||||||
|
|
||||||
|
if ($page.params.instance.toLowerCase() != $instance.toLowerCase()) {
|
||||||
|
if (!$profile?.jwt) return
|
||||||
|
toast({
|
||||||
|
content: 'Do you want to open this post on your home instance?',
|
||||||
|
action: () => {
|
||||||
|
if ($profile?.jwt) fetchOnHome($profile.jwt)
|
||||||
|
},
|
||||||
|
duration: 9999 * 1000,
|
||||||
|
})
|
||||||
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
beforeNavigate(async () => {
|
const fetchOnHome = async (jwt: string) => {
|
||||||
if (
|
|
||||||
$page.params.instance.toLowerCase() != $instance.toLowerCase() &&
|
|
||||||
$profile?.jwt
|
|
||||||
) {
|
|
||||||
const id = toast({
|
const id = toast({
|
||||||
content: 'Attempting to fetch this post on your home instance...',
|
content: 'Attempting to fetch this post on your home instance...',
|
||||||
loading: true,
|
loading: true,
|
||||||
@@ -56,7 +62,7 @@
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
const res = await getClient().resolveObject({
|
const res = await getClient().resolveObject({
|
||||||
auth: $profile.jwt,
|
auth: jwt,
|
||||||
q: post.post_view.post.ap_id,
|
q: post.post_view.post.ap_id,
|
||||||
})
|
})
|
||||||
|
|
||||||
@@ -70,7 +76,6 @@
|
|||||||
removeToast(id)
|
removeToast(id)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
|
||||||
|
|
||||||
let commentsPage = 1
|
let commentsPage = 1
|
||||||
let commentSort: CommentSortType = data.commentSort
|
let commentSort: CommentSortType = data.commentSort
|
||||||
|
|||||||
Reference in new issue
Block a user