Skip to content

Commit e79fc35

Browse files
committed
fix(todo): conditionally _setUser on signup
1 parent 3cd647c commit e79fc35

File tree

1 file changed

+14
-4
lines changed

1 file changed

+14
-4
lines changed

src/index.tsx

+14-4
Original file line numberDiff line numberDiff line change
@@ -182,10 +182,20 @@ export function useNetlifyIdentity(
182182

183183
/******* email auth */
184184
const signupUser = useCallback(
185-
(email: string, password: string, data: Object) =>
186-
// TODO: make setUser optional?
187-
goTrueInstance.signup(email, password, data).then(_setUser),
188-
[goTrueInstance]
185+
(
186+
email: string,
187+
password: string,
188+
data: Object,
189+
directLogin: boolean = true
190+
) =>
191+
goTrueInstance.signup(email, password, data).then(user => {
192+
if (directLogin) {
193+
_setUser(user);
194+
}
195+
196+
return user;
197+
}),
198+
[goTrueInstance, _setUser]
189199
);
190200

191201
const loginUser = useCallback(

0 commit comments

Comments
 (0)