@rpcbase/client 0.48.0 → 0.50.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/base_url.js +16 -0
- package/helpers/post.js +1 -1
- package/package.json +1 -1
- package/rpc_post.js +1 -1
- package/rts/index.js +1 -1
- package/rts/store/get_collection.js +3 -2
package/base_url.js
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/* @flow */
|
|
2
|
+
import axios from "axios"
|
|
3
|
+
|
|
4
|
+
import {SERVER_PORT, HOSTNAME} from "env"
|
|
5
|
+
|
|
6
|
+
const protocol = (typeof window !== "undefined" && window?.location?.protocol) || "http:"
|
|
7
|
+
|
|
8
|
+
// there is no SERVER_PORT in production, as we use the default port and we are behind the gateway
|
|
9
|
+
let BASE_URL
|
|
10
|
+
if (__DEV__) {
|
|
11
|
+
BASE_URL = `${protocol}//${HOSTNAME}:${SERVER_PORT}`
|
|
12
|
+
} else {
|
|
13
|
+
BASE_URL = `https://${HOSTNAME}`
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export default BASE_URL
|
package/helpers/post.js
CHANGED
package/package.json
CHANGED
package/rpc_post.js
CHANGED
|
@@ -7,7 +7,7 @@ import _set from "lodash/set"
|
|
|
7
7
|
import get_txn_id from "@rpcbase/std/get_txn_id"
|
|
8
8
|
import {add_local_txn} from "@rpcbase/client/rts"
|
|
9
9
|
|
|
10
|
-
import
|
|
10
|
+
import BASE_URL from "./base_url"
|
|
11
11
|
|
|
12
12
|
const client = axios.create({
|
|
13
13
|
withCredentials: true,
|
package/rts/index.js
CHANGED
|
@@ -4,11 +4,12 @@ import PouchDB from "pouchdb-core"
|
|
|
4
4
|
import IndexedDBAdapter from "pouchdb-adapter-indexeddb"
|
|
5
5
|
import FindPlugin from "pouchdb-find"
|
|
6
6
|
|
|
7
|
-
import {DATABASE_NAME} from "env"
|
|
7
|
+
import {TENANT_PREFIX, DATABASE_NAME} from "env"
|
|
8
8
|
|
|
9
9
|
const log = debug("rb:store")
|
|
10
10
|
|
|
11
|
-
let prefix =
|
|
11
|
+
let prefix = `rb/${TENANT_PREFIX}/`
|
|
12
|
+
|
|
12
13
|
if (DATABASE_NAME) prefix += `${DATABASE_NAME}/`
|
|
13
14
|
|
|
14
15
|
PouchDB.prefix = prefix
|