@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.mjs
CHANGED
|
@@ -1953,15 +1953,27 @@ function createAuthClient3(config) {
|
|
|
1953
1953
|
return {
|
|
1954
1954
|
signUp: async (data) => {
|
|
1955
1955
|
const result = await client.signUp(data);
|
|
1956
|
-
|
|
1957
|
-
|
|
1956
|
+
const token = result.data?.token || result.data?.session?.token;
|
|
1957
|
+
if (result.success && token) {
|
|
1958
|
+
console.log("[Sandpack Auth] Storing token after sign-up");
|
|
1959
|
+
storeToken(projectId, {
|
|
1960
|
+
token,
|
|
1961
|
+
expiresAt: new Date(Date.now() + 7 * 24 * 60 * 60 * 1e3).toISOString()
|
|
1962
|
+
// 7 days
|
|
1963
|
+
});
|
|
1958
1964
|
}
|
|
1959
1965
|
return result;
|
|
1960
1966
|
},
|
|
1961
1967
|
signIn: async (data) => {
|
|
1962
1968
|
const result = await client.signIn(data);
|
|
1963
|
-
|
|
1964
|
-
|
|
1969
|
+
const token = result.data?.token || result.data?.session?.token;
|
|
1970
|
+
if (result.success && token) {
|
|
1971
|
+
console.log("[Sandpack Auth] Storing token after sign-in");
|
|
1972
|
+
storeToken(projectId, {
|
|
1973
|
+
token,
|
|
1974
|
+
expiresAt: new Date(Date.now() + 7 * 24 * 60 * 60 * 1e3).toISOString()
|
|
1975
|
+
// 7 days
|
|
1976
|
+
});
|
|
1965
1977
|
}
|
|
1966
1978
|
return result;
|
|
1967
1979
|
},
|