@rpcbase/client 0.122.0 → 0.124.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 +2 -2
- package/auth/SignUp/index.js +2 -2
- package/auth/getUid.js +11 -0
- package/auth/index.js +2 -2
- package/auth/sign_out.js +2 -2
- package/package.json +1 -1
- package/rts/getUseQuery/index.js +2 -2
- package/auth/get_uid.js +0 -11
package/auth/SignIn/index.js
CHANGED
|
@@ -9,7 +9,7 @@ import debug from "debug"
|
|
|
9
9
|
import post from "../../helpers/post"
|
|
10
10
|
import {reconnect as rts_reconnect} from "../../rts"
|
|
11
11
|
|
|
12
|
-
import {set_is_signed_in,
|
|
12
|
+
import {set_is_signed_in, setUid, set_tenant_id} from "../index"
|
|
13
13
|
import Footer from "../Footer"
|
|
14
14
|
|
|
15
15
|
import "./sign-in.scss"
|
|
@@ -55,7 +55,7 @@ const SignIn = ({
|
|
|
55
55
|
const {user_id} = res
|
|
56
56
|
assert(res.user_id, "missing user_id")
|
|
57
57
|
|
|
58
|
-
|
|
58
|
+
setUid(user_id)
|
|
59
59
|
set_tenant_id(user_id.slice(0, 8))
|
|
60
60
|
set_is_signed_in(true)
|
|
61
61
|
|
package/auth/SignUp/index.js
CHANGED
|
@@ -4,7 +4,7 @@ import page from "page"
|
|
|
4
4
|
|
|
5
5
|
import {reconnect as rts_reconnect} from "../../rts"
|
|
6
6
|
|
|
7
|
-
import {set_is_signed_in,
|
|
7
|
+
import {set_is_signed_in, setUid, set_tenant_id} from "../index"
|
|
8
8
|
import post from "../../helpers/post"
|
|
9
9
|
import Footer from "../Footer"
|
|
10
10
|
|
|
@@ -31,7 +31,7 @@ const SignUp = ({
|
|
|
31
31
|
|
|
32
32
|
if (res.status === "ok") {
|
|
33
33
|
const {user_id} = res
|
|
34
|
-
|
|
34
|
+
setUid(user_id)
|
|
35
35
|
set_tenant_id(user_id.slice(0, 8))
|
|
36
36
|
set_is_signed_in(true)
|
|
37
37
|
|
package/auth/getUid.js
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/* @flow */
|
|
2
|
+
import {Platform} from "react-native"
|
|
3
|
+
|
|
4
|
+
import {getUid as _getUid} from "./index"
|
|
5
|
+
|
|
6
|
+
const getUid = Platform.OS === "web" ? _getUid : () => {
|
|
7
|
+
console.warn("native should not call getUid, use userId from AuthContext")
|
|
8
|
+
return null
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export default getUid
|
package/auth/index.js
CHANGED
|
@@ -110,8 +110,8 @@ export const session_restrict = (ctx, next) => {
|
|
|
110
110
|
}
|
|
111
111
|
|
|
112
112
|
|
|
113
|
-
export const
|
|
114
|
-
export const
|
|
113
|
+
export const getUid = () => __user_id
|
|
114
|
+
export const setUid = (val) => {
|
|
115
115
|
__user_id = val
|
|
116
116
|
|
|
117
117
|
if (typeof val === "string") {
|
package/auth/sign_out.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
/* @flow */
|
|
2
2
|
|
|
3
|
-
import {set_is_signed_in,
|
|
3
|
+
import {set_is_signed_in, setUid, set_tenant_id} from "./index"
|
|
4
4
|
|
|
5
5
|
export const sign_out = () => {
|
|
6
|
-
|
|
6
|
+
setUid(null)
|
|
7
7
|
set_tenant_id(null)
|
|
8
8
|
set_is_signed_in(false)
|
|
9
9
|
localStorage.clear()
|
package/package.json
CHANGED
package/rts/getUseQuery/index.js
CHANGED
|
@@ -10,7 +10,7 @@ import LZString from "lz-string"
|
|
|
10
10
|
import isEqual from "fast-deep-equal/react"
|
|
11
11
|
|
|
12
12
|
import isEqualValues from "../../isEqualValues"
|
|
13
|
-
import
|
|
13
|
+
import getUid from "../../auth/getUid"
|
|
14
14
|
|
|
15
15
|
import useData from "./useData"
|
|
16
16
|
|
|
@@ -28,7 +28,7 @@ const getUseQuery = (register_query) => (
|
|
|
28
28
|
// TODO: retrieve this from future AuthContext in client
|
|
29
29
|
const uid = useMemo(() => {
|
|
30
30
|
// TODO: why is there a options.userId here ??
|
|
31
|
-
const _uid = Platform.OS === "web" ?
|
|
31
|
+
const _uid = Platform.OS === "web" ? getUid() : options.userId
|
|
32
32
|
assert(_uid, "missing uid")
|
|
33
33
|
return _uid
|
|
34
34
|
}, [])
|
package/auth/get_uid.js
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
/* @flow */
|
|
2
|
-
import {Platform} from "react-native"
|
|
3
|
-
|
|
4
|
-
import {get_uid as _get_uid} from "./index"
|
|
5
|
-
|
|
6
|
-
const get_uid = Platform.OS === "web" ? _get_uid : () => {
|
|
7
|
-
console.warn("native should not call get_uid, use userId from AuthContext")
|
|
8
|
-
return null
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
export default get_uid
|