naystack 1.2.8 → 1.2.9
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.
|
@@ -46,11 +46,14 @@ var TokenContext = (0, import_react.createContext)({
|
|
|
46
46
|
token: null,
|
|
47
47
|
setToken: () => null
|
|
48
48
|
});
|
|
49
|
+
function useSetToken() {
|
|
50
|
+
const { setToken } = (0, import_react.useContext)(TokenContext);
|
|
51
|
+
return setToken;
|
|
52
|
+
}
|
|
49
53
|
|
|
50
54
|
// src/auth/email/client.ts
|
|
51
55
|
function useSignUpWithEmail(endpoint) {
|
|
52
|
-
const
|
|
53
|
-
console.warn(token, setToken, "1");
|
|
56
|
+
const setToken = useSetToken();
|
|
54
57
|
return (0, import_react2.useCallback)(
|
|
55
58
|
async (data) => {
|
|
56
59
|
const res = await fetch(endpoint, {
|
|
@@ -69,7 +72,8 @@ function useSignUpWithEmail(endpoint) {
|
|
|
69
72
|
);
|
|
70
73
|
}
|
|
71
74
|
function useLoginWithEmail(endpoint) {
|
|
72
|
-
const
|
|
75
|
+
const setToken = useSetToken();
|
|
76
|
+
console.warn(setToken, "2");
|
|
73
77
|
return (0, import_react2.useCallback)(
|
|
74
78
|
async (data) => {
|
|
75
79
|
const res = await fetch(endpoint, {
|
|
@@ -23,11 +23,14 @@ var TokenContext = createContext({
|
|
|
23
23
|
token: null,
|
|
24
24
|
setToken: () => null
|
|
25
25
|
});
|
|
26
|
+
function useSetToken() {
|
|
27
|
+
const { setToken } = useContext(TokenContext);
|
|
28
|
+
return setToken;
|
|
29
|
+
}
|
|
26
30
|
|
|
27
31
|
// src/auth/email/client.ts
|
|
28
32
|
function useSignUpWithEmail(endpoint) {
|
|
29
|
-
const
|
|
30
|
-
console.warn(token, setToken, "1");
|
|
33
|
+
const setToken = useSetToken();
|
|
31
34
|
return useCallback2(
|
|
32
35
|
async (data) => {
|
|
33
36
|
const res = await fetch(endpoint, {
|
|
@@ -46,7 +49,8 @@ function useSignUpWithEmail(endpoint) {
|
|
|
46
49
|
);
|
|
47
50
|
}
|
|
48
51
|
function useLoginWithEmail(endpoint) {
|
|
49
|
-
const
|
|
52
|
+
const setToken = useSetToken();
|
|
53
|
+
console.warn(setToken, "2");
|
|
50
54
|
return useCallback2(
|
|
51
55
|
async (data) => {
|
|
52
56
|
const res = await fetch(endpoint, {
|