@rpcbase/client 0.158.0 → 0.160.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/SignInEmailForm.js +3 -2
- package/auth/SignUp/SignUpEmailForm.js +4 -2
- package/auth/index.js +0 -2
- package/package.json +1 -1
- package/rts/rts.js +4 -7
|
@@ -46,11 +46,12 @@ const SignInEmailForm = ({onSuccess, onSuccessRedirect}) => {
|
|
|
46
46
|
assert(res.user_id, "missing user_id")
|
|
47
47
|
|
|
48
48
|
setUid(user_id)
|
|
49
|
-
|
|
49
|
+
const tenantId = user_id.slice(8, 16)
|
|
50
|
+
set_tenant_id(tenantId)
|
|
50
51
|
set_is_signed_in(true)
|
|
51
52
|
|
|
52
53
|
// we must now reconnect on the websocket as we now have a new cookie
|
|
53
|
-
rts_reconnect()
|
|
54
|
+
rts_reconnect(tenantId)
|
|
54
55
|
onSuccess()
|
|
55
56
|
if (redirect) {
|
|
56
57
|
page(redirect)
|
|
@@ -25,11 +25,13 @@ const SignUpEmailForm = ({onSuccessRedirect, onSuccess}) => {
|
|
|
25
25
|
if (res.status === "ok") {
|
|
26
26
|
const {user_id} = res
|
|
27
27
|
setUid(user_id)
|
|
28
|
-
|
|
28
|
+
|
|
29
|
+
const tenantId = user_id.slice(8, 16)
|
|
30
|
+
set_tenant_id(tenantId)
|
|
29
31
|
set_is_signed_in(true)
|
|
30
32
|
|
|
31
33
|
// we must now reconnect on the websocket as we have a new cookie
|
|
32
|
-
rts_reconnect()
|
|
34
|
+
rts_reconnect(tenantId)
|
|
33
35
|
onSuccess()
|
|
34
36
|
page(onSuccessRedirect)
|
|
35
37
|
} else if (res.status === "error") {
|
package/auth/index.js
CHANGED
package/package.json
CHANGED
package/rts/rts.js
CHANGED
|
@@ -7,7 +7,6 @@ import _set from "lodash/set"
|
|
|
7
7
|
import debug from "debug"
|
|
8
8
|
|
|
9
9
|
import getBaseUrl from "../getBaseUrl"
|
|
10
|
-
import getTenantId from "../auth/getTenantId"
|
|
11
10
|
|
|
12
11
|
import store from "./store"
|
|
13
12
|
|
|
@@ -15,7 +14,7 @@ const log = debug("rb:socket")
|
|
|
15
14
|
|
|
16
15
|
const TENANT_ID_HEADER = "rb-tenant-id"
|
|
17
16
|
|
|
18
|
-
// how many local transaction ids are we keeping, it doesn't really need to be that big
|
|
17
|
+
// how many local transaction ids are we keeping, ?it doesn't really need to be that big
|
|
19
18
|
const MAX_TXN_BUF = 2048
|
|
20
19
|
|
|
21
20
|
let _socket
|
|
@@ -88,8 +87,7 @@ const dispatch_query_payload = (payload) => {
|
|
|
88
87
|
}
|
|
89
88
|
|
|
90
89
|
|
|
91
|
-
export const connect = () => new Promise((resolve) => {
|
|
92
|
-
const tenant_id = getTenantId()
|
|
90
|
+
export const connect = (tenant_id) => new Promise((resolve) => {
|
|
93
91
|
|
|
94
92
|
if (tenant_id) {
|
|
95
93
|
log("rts client will connect")
|
|
@@ -98,7 +96,6 @@ export const connect = () => new Promise((resolve) => {
|
|
|
98
96
|
return
|
|
99
97
|
}
|
|
100
98
|
|
|
101
|
-
|
|
102
99
|
_socket = io(getBaseUrl(), {
|
|
103
100
|
forceNew: true,
|
|
104
101
|
transports: ["websocket", "polling"],
|
|
@@ -153,13 +150,13 @@ export const disconnect = () => {
|
|
|
153
150
|
}
|
|
154
151
|
|
|
155
152
|
|
|
156
|
-
export const reconnect = () => {
|
|
153
|
+
export const reconnect = (tenant_id) => {
|
|
157
154
|
log("socket will force reconnect")
|
|
158
155
|
|
|
159
156
|
// destroy current socket if exists
|
|
160
157
|
disconnect()
|
|
161
158
|
|
|
162
|
-
connect()
|
|
159
|
+
connect(tenant_id)
|
|
163
160
|
}
|
|
164
161
|
|
|
165
162
|
// register a query
|