feat: switch to a toast

This commit is contained in:
Xyphyn committed 2023-08-25 14:50:44 -07:00
1 parent 0fbe243f7b
commit 45fbc7d25f
1 file changed
+13 -8
@@ -40,15 +40,21 @@
afterNavigate(async () => {
// reactivity hack
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 () => {
if (
$page.params.instance.toLowerCase() != $instance.toLowerCase() &&
$profile?.jwt
) {
const fetchOnHome = async (jwt: string) => {
const id = toast({
content: 'Attempting to fetch this post on your home instance...',
loading: true,
@@ -56,7 +62,7 @@
try {
const res = await getClient().resolveObject({
auth: $profile.jwt,
auth: jwt,
q: post.post_view.post.ap_id,
})
@@ -70,7 +76,6 @@
removeToast(id)
}
}
})
let commentsPage = 1
let commentSort: CommentSortType = data.commentSort