@erikey/react 0.1.5 → 0.1.6
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/dist/index.js +16 -4
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +16 -4
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1978,15 +1978,27 @@ function createAuthClient3(config) {
|
|
|
1978
1978
|
return {
|
|
1979
1979
|
signUp: async (data) => {
|
|
1980
1980
|
const result = await client.signUp(data);
|
|
1981
|
-
|
|
1982
|
-
|
|
1981
|
+
const token = result.data?.token || result.data?.session?.token;
|
|
1982
|
+
if (result.success && token) {
|
|
1983
|
+
console.log("[Sandpack Auth] Storing token after sign-up");
|
|
1984
|
+
storeToken(projectId, {
|
|
1985
|
+
token,
|
|
1986
|
+
expiresAt: new Date(Date.now() + 7 * 24 * 60 * 60 * 1e3).toISOString()
|
|
1987
|
+
// 7 days
|
|
1988
|
+
});
|
|
1983
1989
|
}
|
|
1984
1990
|
return result;
|
|
1985
1991
|
},
|
|
1986
1992
|
signIn: async (data) => {
|
|
1987
1993
|
const result = await client.signIn(data);
|
|
1988
|
-
|
|
1989
|
-
|
|
1994
|
+
const token = result.data?.token || result.data?.session?.token;
|
|
1995
|
+
if (result.success && token) {
|
|
1996
|
+
console.log("[Sandpack Auth] Storing token after sign-in");
|
|
1997
|
+
storeToken(projectId, {
|
|
1998
|
+
token,
|
|
1999
|
+
expiresAt: new Date(Date.now() + 7 * 24 * 60 * 60 * 1e3).toISOString()
|
|
2000
|
+
// 7 days
|
|
2001
|
+
});
|
|
1990
2002
|
}
|
|
1991
2003
|
return result;
|
|
1992
2004
|
},
|