@rpcbase/client 0.31.0 → 0.32.0
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/auth/SignIn/index.js +3 -1
- package/auth/SignUp/index.js +3 -0
- package/package.json +1 -1
package/auth/SignIn/index.js
CHANGED
|
@@ -21,7 +21,8 @@ const SIGNIN_WITH_GITHUB = false
|
|
|
21
21
|
const SignIn = ({
|
|
22
22
|
name,
|
|
23
23
|
logo,
|
|
24
|
-
onSuccessRedirect = "/dashboard"
|
|
24
|
+
onSuccessRedirect = "/dashboard",
|
|
25
|
+
onSuccess = () => null
|
|
25
26
|
}) => {
|
|
26
27
|
const [isLoading, setIsLoading] = useState(false)
|
|
27
28
|
const [errors, setErrors] = useState()
|
|
@@ -52,6 +53,7 @@ const SignIn = ({
|
|
|
52
53
|
log("redirect to:", redirect || onSuccessRedirect)
|
|
53
54
|
set_uid(res.user_id)
|
|
54
55
|
set_is_signed_in(true)
|
|
56
|
+
onSuccess()
|
|
55
57
|
if (redirect) {
|
|
56
58
|
page(redirect)
|
|
57
59
|
} else {
|
package/auth/SignUp/index.js
CHANGED
|
@@ -12,6 +12,7 @@ const SignUp = ({
|
|
|
12
12
|
logo,
|
|
13
13
|
name,
|
|
14
14
|
onSuccessRedirect = "/dashboard",
|
|
15
|
+
onSuccess = () => null,
|
|
15
16
|
}) => {
|
|
16
17
|
const [email, setEmail] = useState("")
|
|
17
18
|
const [password, setPassword] = useState("")
|
|
@@ -26,7 +27,9 @@ const SignUp = ({
|
|
|
26
27
|
}
|
|
27
28
|
const res = await post("/api/v1/auth/sign_up", {email, password})
|
|
28
29
|
if (res.status === "ok") {
|
|
30
|
+
set_uid(res.user_id)
|
|
29
31
|
set_is_signed_in(true)
|
|
32
|
+
onSuccess()
|
|
30
33
|
page(onSuccessRedirect)
|
|
31
34
|
} else if (res.status === "error") {
|
|
32
35
|
setError(res.message)
|