feat: switch to new account system

This commit is contained in:
Xyphyn committed 2023-08-01 13:00:06 -07:00
1 parent 54ab6fdc82
commit 2da415b670
38 files changed
+222 -362

No files matched your search

@@ -5,8 +5,9 @@
import Post from '$lib/components/lemmy/post/Post.svelte'
import Modal from '$lib/components/ui/modal/Modal.svelte'
import { ToastType, toast } from '$lib/components/ui/toasts/toasts.js'
import { authData, getClient } from '$lib/lemmy.js'
import { getClient } from '$lib/lemmy.js'
import type { CommentView, PostView } from 'lemmy-js-client'
import { profile } from '$lib/auth.js'
export let open: boolean
export let item: PostView | CommentView | undefined = undefined
@@ -21,19 +22,19 @@
let reason = ''
async function report() {
if (!item || !$authData || reason == '') return
if (!item || !$profile?.jwt || reason == '') return
loading = true
try {
if (isComment(item)) {
await getClient().createCommentReport({
auth: $authData.token,
auth: $profile.jwt,
comment_id: item.comment.id,
reason: reason,
})
} else if (isPost(item)) {
await getClient().createPostReport({
auth: $authData.token,
auth: $profile.jwt,
post_id: item.post.id,
reason: reason,
})