naystack 1.2.12 → 1.2.13

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.
@@ -20,10 +20,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
20
20
  // src/auth/email/client.ts
21
21
  var client_exports = {};
22
22
  __export(client_exports, {
23
- getEmailAuthUtils: () => getEmailAuthUtils,
24
- useLoginWithEmail: () => useLoginWithEmail,
25
- useLogout: () => useLogout,
26
- useSignUpWithEmail: () => useSignUpWithEmail
23
+ getEmailAuthUtils: () => getEmailAuthUtils
27
24
  });
28
25
  module.exports = __toCommonJS(client_exports);
29
26
  var import_client = require("naystack/graphql/client");
@@ -49,7 +46,6 @@ function useSignUpWithEmail(endpoint) {
49
46
  }
50
47
  function useLoginWithEmail(endpoint) {
51
48
  const setToken = (0, import_client.useSetToken)();
52
- console.warn(setToken, "2");
53
49
  return (0, import_react.useCallback)(
54
50
  async (data) => {
55
51
  const res = await fetch(endpoint, {
@@ -68,8 +64,7 @@ function useLoginWithEmail(endpoint) {
68
64
  );
69
65
  }
70
66
  function useLogout(endpoint) {
71
- const { setToken, token } = (0, import_react.useContext)(import_client.TokenContext);
72
- console.warn(token, setToken, "1");
67
+ const setToken = (0, import_client.useSetToken)();
73
68
  return (0, import_react.useCallback)(
74
69
  async (data) => {
75
70
  setToken(null);
@@ -91,8 +86,5 @@ function getEmailAuthUtils(endpoint) {
91
86
  }
92
87
  // Annotate the CommonJS export names for ESM import in node:
93
88
  0 && (module.exports = {
94
- getEmailAuthUtils,
95
- useLoginWithEmail,
96
- useLogout,
97
- useSignUpWithEmail
89
+ getEmailAuthUtils
98
90
  });
@@ -1,10 +1,7 @@
1
- declare function useSignUpWithEmail(endpoint: string): (data: object) => Promise<string | null>;
2
- declare function useLoginWithEmail(endpoint: string): (data: object) => Promise<string | null>;
3
- declare function useLogout(endpoint: string): (data?: object) => Promise<void>;
4
1
  declare function getEmailAuthUtils(endpoint: string): {
5
2
  useSignUp: () => (data: object) => Promise<string | null>;
6
3
  useLogin: () => (data: object) => Promise<string | null>;
7
4
  useLogout: () => (data?: object) => Promise<void>;
8
5
  };
9
6
 
10
- export { getEmailAuthUtils, useLoginWithEmail, useLogout, useSignUpWithEmail };
7
+ export { getEmailAuthUtils };
@@ -1,10 +1,7 @@
1
- declare function useSignUpWithEmail(endpoint: string): (data: object) => Promise<string | null>;
2
- declare function useLoginWithEmail(endpoint: string): (data: object) => Promise<string | null>;
3
- declare function useLogout(endpoint: string): (data?: object) => Promise<void>;
4
1
  declare function getEmailAuthUtils(endpoint: string): {
5
2
  useSignUp: () => (data: object) => Promise<string | null>;
6
3
  useLogin: () => (data: object) => Promise<string | null>;
7
4
  useLogout: () => (data?: object) => Promise<void>;
8
5
  };
9
6
 
10
- export { getEmailAuthUtils, useLoginWithEmail, useLogout, useSignUpWithEmail };
7
+ export { getEmailAuthUtils };
@@ -1,6 +1,6 @@
1
1
  // src/auth/email/client.ts
2
- import { TokenContext, useSetToken } from "naystack/graphql/client";
3
- import { useCallback, useContext } from "react";
2
+ import { useSetToken } from "naystack/graphql/client";
3
+ import { useCallback } from "react";
4
4
  function useSignUpWithEmail(endpoint) {
5
5
  const setToken = useSetToken();
6
6
  return useCallback(
@@ -22,7 +22,6 @@ function useSignUpWithEmail(endpoint) {
22
22
  }
23
23
  function useLoginWithEmail(endpoint) {
24
24
  const setToken = useSetToken();
25
- console.warn(setToken, "2");
26
25
  return useCallback(
27
26
  async (data) => {
28
27
  const res = await fetch(endpoint, {
@@ -41,8 +40,7 @@ function useLoginWithEmail(endpoint) {
41
40
  );
42
41
  }
43
42
  function useLogout(endpoint) {
44
- const { setToken, token } = useContext(TokenContext);
45
- console.warn(token, setToken, "1");
43
+ const setToken = useSetToken();
46
44
  return useCallback(
47
45
  async (data) => {
48
46
  setToken(null);
@@ -63,8 +61,5 @@ function getEmailAuthUtils(endpoint) {
63
61
  };
64
62
  }
65
63
  export {
66
- getEmailAuthUtils,
67
- useLoginWithEmail,
68
- useLogout,
69
- useSignUpWithEmail
64
+ getEmailAuthUtils
70
65
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "naystack",
3
- "version": "1.2.12",
3
+ "version": "1.2.13",
4
4
  "description": "A stack built with Next + GraphQL + S3 + Auth",
5
5
  "main": "dist/index.cjs.js",
6
6
  "module": "dist/index.esm.js",