nuxt-atproto 0.0.3 → 0.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -230,20 +230,22 @@ Logs out the currently authenticated user and clears the stored session data.
230
230
 
231
231
  <br />
232
232
 
233
- ### 🔢 agent
233
+ ### ➡️ isLogged()
234
234
 
235
- Provides an object containing both a public `AtpAgent` for general access and an authenticated `Agent` to perform actions that require a logged-in user, such as posting, following, and liking.
235
+ Indicates whether the user is currently authenticated.
236
236
 
237
237
  ```ts
238
238
  const atproto = useAtproto()
239
239
 
240
- const profile = await atproto.agent.public.getProfile({actor: 'owdproject.org'})
241
- console.log(profile.data)
242
-
243
- const likedPost = await atproto.agent.account.likePost({cid, uri})
244
- console.log(likedPost.data)
240
+ if (atproto.isLogged()) {
241
+ console.log('User is authenticated')
242
+ } else {
243
+ console.log('User is not logged in')
244
+ }
245
245
  ```
246
246
 
247
+ **Returns**: Returns a boolean indicating whether the user is authenticated.
248
+
247
249
  <br />
248
250
 
249
251
  ## 🧩 useAgent(service?: string, fetch?: any)
package/dist/module.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "nuxt-atproto",
3
3
  "configKey": "atproto",
4
- "version": "0.0.3",
4
+ "version": "0.0.4",
5
5
  "builder": {
6
6
  "@nuxt/module-builder": "1.0.1",
7
7
  "unbuild": "3.5.0"
@@ -4,5 +4,5 @@ export declare function useAtproto(service?: string, fetch?: any): {
4
4
  signInWithHandle: (handle?: string, options?: any) => Promise<void>;
5
5
  signOut: () => Promise<void>;
6
6
  restore: (did: string) => Promise<OAuthSession>;
7
- agent: import("@atproto/api").Agent;
7
+ isLogged: () => any;
8
8
  };
@@ -1,5 +1,4 @@
1
1
  import { useRuntimeConfig, useNuxtApp } from "nuxt/app";
2
- import { useAgent } from "./useAgent.js";
3
2
  export function useAtproto(service, fetch) {
4
3
  const runtimeConfig = useRuntimeConfig();
5
4
  async function signIn(serviceEndpoint = runtimeConfig.public.atproto.serviceEndpoint.private, options = runtimeConfig.public.atproto.oauth.signInOptions) {
@@ -47,12 +46,15 @@ export function useAtproto(service, fetch) {
47
46
  console.log("User signed out");
48
47
  }
49
48
  }
50
- const agent = useAgent(service, fetch);
49
+ function isLogged() {
50
+ const { $atproto } = useNuxtApp();
51
+ return $atproto.session.value;
52
+ }
51
53
  return {
52
54
  signIn,
53
55
  signInWithHandle,
54
56
  signOut,
55
57
  restore,
56
- agent
58
+ isLogged
57
59
  };
58
60
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nuxt-atproto",
3
- "version": "0.0.3",
3
+ "version": "0.0.4",
4
4
  "description": "Interact with AT Protocol and Bluesky in your Nuxt.js application",
5
5
  "keywords": [
6
6
  "nuxt",