feat: switch to new account system
This commit is contained in:
1 parent
54ab6fdc82
commit
2da415b670
38 files changed
+222
-362
No files matched your search
@@ -1,4 +1,5 @@
|
||||
import { authData, getClient } from '$lib/lemmy.js'
|
||||
import { profile } from '$lib/auth.js'
|
||||
import { getClient } from '$lib/lemmy.js'
|
||||
import type { ListingType } from 'lemmy-js-client'
|
||||
import { get } from 'svelte/store'
|
||||
|
||||
@@ -15,7 +16,7 @@ export async function load({ url }) {
|
||||
type_: 'Communities',
|
||||
listing_type: type,
|
||||
q: query,
|
||||
auth: get(authData)?.token,
|
||||
auth: get(profile)?.jwt,
|
||||
})
|
||||
} else {
|
||||
return await getClient().listCommunities({
|
||||
@@ -23,7 +24,7 @@ export async function load({ url }) {
|
||||
page: page,
|
||||
sort: 'TopAll',
|
||||
type_: type,
|
||||
auth: get(authData)?.token,
|
||||
auth: get(profile)?.jwt,
|
||||
})
|
||||
}
|
||||
}
|
||||
@@ -1,25 +1,21 @@
|
||||
<script lang="ts">
|
||||
import { getClient } from '$lib/lemmy.js'
|
||||
import type {
|
||||
Community,
|
||||
CommunityView,
|
||||
SubscribedType,
|
||||
} from 'lemmy-js-client'
|
||||
import { authData } from '$lib/lemmy.js'
|
||||
import type { CommunityView } from 'lemmy-js-client'
|
||||
import { ToastType, addToast } from '$lib/components/ui/toasts/toasts.js'
|
||||
import { profile } from '$lib/auth.js'
|
||||
|
||||
export let community: CommunityView
|
||||
|
||||
let subscribing = false
|
||||
|
||||
async function subscribe() {
|
||||
if (!$authData?.token) return
|
||||
if (!$profile?.jwt) return
|
||||
|
||||
subscribing = true
|
||||
|
||||
try {
|
||||
const res = await getClient().followCommunity({
|
||||
auth: $authData.token,
|
||||
auth: $profile.jwt,
|
||||
community_id: community.community.id,
|
||||
follow: community.subscribed == 'NotSubscribed',
|
||||
})
|
||||
|
||||
Reference in new issue
Block a user