fix: use svelte store to init bsky client
All checks were successful
create archive with lfs / tag (push) Successful in 9s
All checks were successful
create archive with lfs / tag (push) Successful in 9s
This commit is contained in:
parent
4a4db8e610
commit
a2ac850abb
@ -26,4 +26,4 @@ const loginToBsky = () => {
|
||||
creds.login({identifier: 'gaze.systems', password: env.BSKY_PASSWORD ?? "" })
|
||||
return new Agent(creds)
|
||||
}
|
||||
export const bskyClient = loginToBsky()
|
||||
export const bskyClient = writable(loginToBsky())
|
@ -2,6 +2,7 @@ import { env } from '$env/dynamic/private';
|
||||
import { PUBLIC_BASE_URL } from '$env/static/public';
|
||||
import { bskyClient } from '$lib';
|
||||
import { createNote } from '$lib/notes.js';
|
||||
import { get } from 'svelte/store';
|
||||
|
||||
|
||||
export const POST = async ({ request }) => {
|
||||
@ -19,7 +20,7 @@ export const POST = async ({ request }) => {
|
||||
const noteId = createNote({ content: noteData.content, published })
|
||||
// bridge to bsky if want to bridge
|
||||
if (noteData.bskyPosse ?? null !== null) {
|
||||
await bskyClient.post({text: `${noteData.content} (${PUBLIC_BASE_URL}/log?id=${noteId})`})
|
||||
await get(bskyClient).post({text: `${noteData.content} (${PUBLIC_BASE_URL}/log?id=${noteId})`})
|
||||
}
|
||||
// send back created note id
|
||||
return new Response(JSON.stringify({ noteId }), {
|
||||
|
Loading…
Reference in New Issue
Block a user