From 8927d6b9e5386b14a707d7f7c5f03471977fcbd1 Mon Sep 17 00:00:00 2001 From: Dennison Bertram Date: Sun, 14 Jun 2020 20:24:09 -0400 Subject: [PATCH 01/10] =?UTF-8?q?=F0=9F=93=A6=20NEW:=20Add=20user=20base?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package.json | 2 + src/ProvidersWrapper.tsx | 20 +++++++++ src/components/userBase/UserBase.tsx | 62 ++++++++++++++++++++++++++++ 3 files changed, 84 insertions(+) create mode 100644 src/components/userBase/UserBase.tsx diff --git a/package.json b/package.json index 2b5e380..b19aa34 100644 --- a/package.json +++ b/package.json @@ -71,6 +71,7 @@ "react-dev-utils": "10.0.0", "react-device-detect": "^1.11.14", "react-dom": "^16.12.0", + "react-modal": "^3.11.2", "react-toast-notifications": "^2.4.0", "react-tooltip": "^3.11.6", "resolve": "1.12.2", @@ -83,6 +84,7 @@ "ts-pnp": "1.1.5", "typescript": "^3.7.5", "url-loader": "2.3.0", + "userbase-js": "^1.4.1", "webpack": "4.41.2", "webpack-dev-server": "3.9.0", "webpack-manifest-plugin": "2.2.0", diff --git a/src/ProvidersWrapper.tsx b/src/ProvidersWrapper.tsx index ca4fbd9..8fd58ec 100644 --- a/src/ProvidersWrapper.tsx +++ b/src/ProvidersWrapper.tsx @@ -8,7 +8,11 @@ import * as consts from 'consts' import { DomElementsContext, EthereumContext } from 'contexts' import { EmitterProvider } from 'providers/EmitterProvider/provider' import { useWeb3Provider } from 'hooks' +import userbase from 'userbase-js' import { Activator } from './Activator' +import { UserBase as UBase } from './components/userBase/UserBase' + +console.log('userbase', userbase) export const ProvidersWrapper: React.FC = () => { // react hooks @@ -23,6 +27,21 @@ export const ProvidersWrapper: React.FC = () => { const ethereum = useWeb3Provider(consts.global.POLLING_INTERVAL) // This sets refresh speed of the whole app + // load serBase + // const [ db, setDB ] = useState(null) + useEffect(() => { + + userbase.init({ appId: '133a735a-a754-4e59-9aa9-8bfd1786c4c6' }).then((session) => { + // SDK initialized successfully + console.log('The session', session) + if (session.user) { + // there is a valid active session + console.log(session.user.username) + } + }).catch((e) => console.error(e)) + + }, []) + // load contracts effects only if not paused useEffect(() => { const getConfig = async () => { @@ -82,6 +101,7 @@ export const ProvidersWrapper: React.FC = () => { + { + let subtitle + + const [ modalIsOpen, setIsOpen ] = useState(false) + + const openModal = () => { + setIsOpen(true) + } + + const closeModal = () => { + setIsOpen(false) + } + + useEffect(() => { + if (window.dappHero) { + window.dappHero.db = db + window.dappHero.openModal = openModal + window.dappHero.closeModal = closeModal + } + }, [ window.dappHero, db ]) + + return ( +
+ + + + {/*

(subtitle = _subtitle)}>Hello

*/} + +
I am a modal
+
+ + + +
+
+
+ ) +} + From 8cc1012f97cabc0a8fc3cec22289ef065c06cb36 Mon Sep 17 00:00:00 2001 From: Dennison Bertram Date: Sun, 14 Jun 2020 20:26:54 -0400 Subject: [PATCH 02/10] =?UTF-8?q?=F0=9F=91=8C=20IMPROVE:=20Add=20userBase?= =?UTF-8?q?=20(db)=20to=20window?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Activator.tsx | 3 +++ src/ProvidersWrapper.tsx | 1 + src/components/userBase/UserBase.tsx | 2 +- 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/Activator.tsx b/src/Activator.tsx index 160f3cf..70397fc 100644 --- a/src/Activator.tsx +++ b/src/Activator.tsx @@ -26,6 +26,7 @@ type ActivatorProps = { timeStamp: any; contractElements: any; domElementsFilteredForContracts: any; + db: any; } export const Activator: React.FC = ({ @@ -37,6 +38,7 @@ export const Activator: React.FC = ({ supportedNetworks, contractElements, domElementsFilteredForContracts, + db, }: ActivatorProps) => { // Ethereum @@ -66,6 +68,7 @@ export const Activator: React.FC = ({ retriggerEngine, projectId: consts.global.apiKey, provider: ethereum, + db, toggleHighlight(): void { dappHero.highlightEnabled = !dappHero.highlightEnabled highlightDomElements(dappHero.highlightEnabled, domElements) diff --git a/src/ProvidersWrapper.tsx b/src/ProvidersWrapper.tsx index 8fd58ec..a031edd 100644 --- a/src/ProvidersWrapper.tsx +++ b/src/ProvidersWrapper.tsx @@ -111,6 +111,7 @@ export const ProvidersWrapper: React.FC = () => { supportedNetworks={supportedNetworks} domElementsFilteredForContracts={smartcontractElements.domElementsFilteredForContracts} contractElements={smartcontractElements.contractElements} + db={userbase} />
diff --git a/src/components/userBase/UserBase.tsx b/src/components/userBase/UserBase.tsx index 035e2e5..12574f1 100644 --- a/src/components/userBase/UserBase.tsx +++ b/src/components/userBase/UserBase.tsx @@ -30,7 +30,7 @@ export const UserBase = ({ db }) => { useEffect(() => { if (window.dappHero) { - window.dappHero.db = db + // window.dappHero.db = db window.dappHero.openModal = openModal window.dappHero.closeModal = closeModal } From 74b197d0a44eb8c8fbdbac8fee332ab45372ee1c Mon Sep 17 00:00:00 2001 From: Dennison Bertram Date: Mon, 15 Jun 2020 10:02:44 -0400 Subject: [PATCH 03/10] =?UTF-8?q?=F0=9F=93=A6=20NEW:=20=20Add=20Matic?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/consts/provider.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/consts/provider.ts b/src/consts/provider.ts index 963cd10..21f2758 100644 --- a/src/consts/provider.ts +++ b/src/consts/provider.ts @@ -34,5 +34,9 @@ export const readProviders = { http: 'https://dai.poa.network', ws: 'wss://dai-trace-ws.blockscout.com/ws', }, + maticMumbai: { + http: `https://rpc-mumbai.matic.today`, + ws: '', + }, } From 059cd7cf1fcce8f2f0688791c776d59abccb6a1f Mon Sep 17 00:00:00 2001 From: Dennison Bertram Date: Mon, 15 Jun 2020 10:31:06 -0400 Subject: [PATCH 04/10] =?UTF-8?q?=F0=9F=91=8C=20IMPROVE:=20Add=20Matic?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/consts/provider.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/consts/provider.ts b/src/consts/provider.ts index 21f2758..e76c1bb 100644 --- a/src/consts/provider.ts +++ b/src/consts/provider.ts @@ -34,7 +34,7 @@ export const readProviders = { http: 'https://dai.poa.network', ws: 'wss://dai-trace-ws.blockscout.com/ws', }, - maticMumbai: { + maticMumbaiTestnet: { http: `https://rpc-mumbai.matic.today`, ws: '', }, From 499b6ad13375dc77977953e57b670066126614c6 Mon Sep 17 00:00:00 2001 From: Dennison Bertram Date: Mon, 15 Jun 2020 11:32:01 -0400 Subject: [PATCH 05/10] =?UTF-8?q?=F0=9F=91=8C=20IMPROVE:=20Fix=20Matic=20a?= =?UTF-8?q?nd=20UserBase=20Support?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/index.html | 1331 ++++++++++++++------------------------ src/ProvidersWrapper.tsx | 7 +- src/consts/global.ts | 1 + src/consts/provider.ts | 6 +- 4 files changed, 507 insertions(+), 838 deletions(-) diff --git a/public/index.html b/public/index.html index 8cadef0..ef895ce 100644 --- a/public/index.html +++ b/public/index.html @@ -1,845 +1,516 @@ - - - - - - DappHero: Components - - - - - -
- - -

Network Features

- - -
Network: Get ID
-

NetworkID should be here

- - - - - -
Network: Get Name
-
Network ID should be here
- - - - - - - -
Network: Get Provider
-
Network provider should be here
- - - - - - - -
Network: Transfer - (unfinished)
- - - -
- - - - - - - -
Network: Get Provider
-
Network provider should be here
- - - - - - -
Network: Enable Button (unfinished)
- - - - - -

User Features

- - -
User: Account Adddress
-

User Address Should be Here

- - -
User: Account Adddress Short
-

User Address Should be Here

- - -
User: Get Balance
-

User Address Should be Here

- - -

3Box Features

- - -
3Box: UserName
-

3box name

- -
3Box: Website
-

3box website

- - - - - - - - - - - - - - - - - - -

Custom Contract

- -
Method: "hello"
-
Payable: false - StateMutability: "view"
-
-

Inputs

-
    -
  • none
  • -
- -

Outputs

-
    -
  • no name - bytes32
  • -
-
- -
- - -
- *Return value: -* -
-
- -
- - -
Method: "sendEthWithArgs"
-
Payable: true - StateMutability: "payable"
-
No ETH Sent
-
-

Inputs

-
    -
  • message - bytes32
  • -
- -

Outputs

-
    -
  • none
  • -
-
- -
- - - - -
- *Return value: -* -
-
- -
- - - - -
Method: "sendEthWithArgs"
-
Payable: true - StateMutability: "payable"
-
ETH Value: HardCoded: .15ETH
-
-

Inputs

-
    -
  • message - bytes32
  • -
- -

Outputs

-
    -
  • none
  • -
-
- -
- - - - -
- *Return value: -* -
-
- -
- - - - - -
Method: "sendEthWithArgs"
-
Payable: true - StateMutability: "payable"
-
ETH Value: User Input
-
-

Inputs

-
    -
  • message - bytes32
  • -
- -

Outputs

-
    -
  • none
  • -
-
- -
This is the method
- - - - - - - -
- *Return value: -* -
- - -
- - - - - - - - -
Method: "viewMultipleArgsMultipleReturn"
-
Payable: false - StateMutability: "view"
-
-

Inputs

-
    -
  • from - address
  • -
  • multiplier - uint256
  • -
- -

Outputs

-
    -
  • _balanceMultiplied - uint256
  • -
  • _hello - bytes32
  • -
-
- -
- - - - - -
- *Return value: -* -
-
- - - - - -
Method: "sendVariableEthNoArgs"
-
Payable: true - StateMutability: "payable"
-
No eth is sent here.
-
-

Inputs

-
    -
  • none
  • -
- -

Outputs

-
    -
  • none
  • -
- > - -
- - -
- *Return value: -* -
-
- -
- - -
Method: "viewMultipleArgsSingleReturn"
-
Payable: false - StateMutability: "view"
-
-

Inputs

-
    -
  • fromAddress - address
  • -
  • amount - uint256
  • -
- -

Outputs

-
    -
  • longInteger - uint256 : (Should be: 8989898989)
  • -
-
- -
- - - - - - -
- *Return value: -* -
-
- -
- - -
Method: "viewNoArgsMultipleReturn"
-
Payable: false - StateMutability: "view"
-
-

Inputs

-
    -
  • none
  • -
- -

Outputs

-
    -
  • importantNumber - uint256 (should be zero)
  • -
  • hello - bytes32
  • -
-
- -
- --> - - All the args are returned in one, and in their respective output -
- A greeting here in bytes32 -
-
- A greeting here in bytes32 -
- -
Important Number here
- -
- *Return value: -* -
-
- *Return value: -* -
-
- -
- - - - - - - - - - - - - - - - - - - - -
ERC721 - Single NFT from an Owner
-
With Owner Account address and Token id
- -
-
-
- -
-

-
- $THIS_TokenID -
-
- -
- -
- - - -
ERC721 - List of specific NFTs from an Owner
-
With Owner Account address and Token ids
- -
-
- -

-
-
- -
- - - -
ERC721 - List of NFTs from an Owner
-
With Owner Account address
- -
-
- -

-
-
- -
- - -
ERC721 - List of NFTs from an Owner with Pagination
-
With Owner Account address
- -
- - - -
- -

-
-
- -
- - -
ERC721 - Single NFT from an Contract
-
With Asset contract address
- -
-
- -

-
-
- -
- - -
ERC721 - List of NFTs from an Contract
-
With Asset contract address
- -
-
- -

-
-
- -
- - -
ERC721 - List of NFTs from an Contract
-
With Asset contract address
- -
-
- -

-
-
- -
- - +

+
-
+

MaticWrappedEth

+
+
+

Public Methods

+
+
+

Method "name"

+
+ +
+
+
+ , +
+
+

Method "totalSupply"

+
+ +
+
+
+ , +
+
+

Method "decimals"

+
+ +
+
+
+ , +
+
+

Method "balanceOf"

+
+ +
+
+
+ , +
+
+

Method "symbol"

+
+ +
+
+
+ , +
+
+

Method "allowance"

+
+ +
+
+
+
+
+
+
+

Transaction Methods

+
+
+

Method "approve"

+
+ +
+
+
+ , +
+
+

Method "transferFrom"

+
+ +
+
+
+ , +
+
+

Method "withdraw"

+
+ +
+
+
+ , +
+
+

Method "transfer"

+
+ +
+
+
+ , +
+
+

Method "deposit"

+
+ +
+
+
+
+
- - - + + + - diff --git a/src/ProvidersWrapper.tsx b/src/ProvidersWrapper.tsx index a031edd..3ba7802 100644 --- a/src/ProvidersWrapper.tsx +++ b/src/ProvidersWrapper.tsx @@ -12,8 +12,6 @@ import userbase from 'userbase-js' import { Activator } from './Activator' import { UserBase as UBase } from './components/userBase/UserBase' -console.log('userbase', userbase) - export const ProvidersWrapper: React.FC = () => { // react hooks const [ configuration, setConfig ] = useState(null) @@ -31,12 +29,11 @@ export const ProvidersWrapper: React.FC = () => { // const [ db, setDB ] = useState(null) useEffect(() => { - userbase.init({ appId: '133a735a-a754-4e59-9aa9-8bfd1786c4c6' }).then((session) => { + userbase.init({ appId: process.env.REACT_APP_USERBASE_APP_ID }).then((session) => { // SDK initialized successfully - console.log('The session', session) if (session.user) { // there is a valid active session - console.log(session.user.username) + // console.log(session.user.username) } }).catch((e) => console.error(e)) diff --git a/src/consts/global.ts b/src/consts/global.ts index 07fafcf..31c8cc8 100644 --- a/src/consts/global.ts +++ b/src/consts/global.ts @@ -9,6 +9,7 @@ export const ethNetworkName = { 77: 'Sokol', 99: 'Core', 100: 'Xdai', + 80001: 'maticMumbaiTestnet', } const apiKeyElement = document.getElementById('dh-apiKey') export const apiKey = apiKeyElement.getAttribute('data-api') diff --git a/src/consts/provider.ts b/src/consts/provider.ts index e76c1bb..17dc025 100644 --- a/src/consts/provider.ts +++ b/src/consts/provider.ts @@ -30,12 +30,12 @@ export const readProviders = { http: 'https://eth-goerli.alchemyapi.io/v2/mo2KeoBlZY6CAyc2o1i4BcBNioVN_wpJ', ws: 'wss://eth-goerli.ws.alchemyapi.io/v2/mo2KeoBlZY6CAyc2o1i4BcBNioVN_wpJ', }, - xDai: { + xdai: { http: 'https://dai.poa.network', ws: 'wss://dai-trace-ws.blockscout.com/ws', }, - maticMumbaiTestnet: { - http: `https://rpc-mumbai.matic.today`, + maticmumbaitestnet: { + http: 'https://rpc-mumbai.matic.today', ws: '', }, From 76c98bce2b4a0491cf549e760f281d22720e9cd3 Mon Sep 17 00:00:00 2001 From: Dennison Bertram Date: Mon, 15 Jun 2020 12:14:33 -0400 Subject: [PATCH 06/10] =?UTF-8?q?=F0=9F=91=8C=20IMPROVE:=20disable=20User?= =?UTF-8?q?=20base=20for=20the=20moment?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Activator.tsx | 2 +- src/ProvidersWrapper.tsx | 7 ++++++- src/api/dappHero.ts | 4 ++-- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/src/Activator.tsx b/src/Activator.tsx index 70397fc..87e1e80 100644 --- a/src/Activator.tsx +++ b/src/Activator.tsx @@ -68,7 +68,7 @@ export const Activator: React.FC = ({ retriggerEngine, projectId: consts.global.apiKey, provider: ethereum, - db, + // db, toggleHighlight(): void { dappHero.highlightEnabled = !dappHero.highlightEnabled highlightDomElements(dappHero.highlightEnabled, domElements) diff --git a/src/ProvidersWrapper.tsx b/src/ProvidersWrapper.tsx index 3ba7802..95f99d7 100644 --- a/src/ProvidersWrapper.tsx +++ b/src/ProvidersWrapper.tsx @@ -26,10 +26,15 @@ export const ProvidersWrapper: React.FC = () => { const ethereum = useWeb3Provider(consts.global.POLLING_INTERVAL) // This sets refresh speed of the whole app // load serBase - // const [ db, setDB ] = useState(null) + const [ db, setDB ] = useState(null) useEffect(() => { userbase.init({ appId: process.env.REACT_APP_USERBASE_APP_ID }).then((session) => { + userbase.deleteUser = null + userbase.purchaseSubscription = null + userbase.cancelSubscription = null + userbase.resumeSubscription = null + userbase.updatePaymentMethod = null // SDK initialized successfully if (session.user) { // there is a valid active session diff --git a/src/api/dappHero.ts b/src/api/dappHero.ts index 08a8fa5..99b62e1 100644 --- a/src/api/dappHero.ts +++ b/src/api/dappHero.ts @@ -117,11 +117,11 @@ export const getContractsByProjectKey = async (projectId) => { return (await getContractsByProjectKeyDappHero(projectId)) } catch (error) { // If the error fails, then try bubble - logger.log('(DH-CORE) Error in Global Cache Network, re-trying...', error) + logger.error('(DH-CORE) Error in Global Cache Network, re-trying...', error) try { return (await getContractsByProjectKeyBubble(projectId) ) } catch (error) { - logger.log('(DH-CORE) Failure in project cache backend', error) + logger.error('(DH-CORE) Failure in project cache backend', error) } } } From 03aef87a039c36feabb217d4e6de6e9974bc0ccf Mon Sep 17 00:00:00 2001 From: Dennison Bertram Date: Mon, 15 Jun 2020 15:47:46 -0400 Subject: [PATCH 07/10] =?UTF-8?q?=F0=9F=93=A6=20NEW:=20=20working=20userba?= =?UTF-8?q?se!?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Activator.tsx | 2 +- src/ProvidersWrapper.tsx | 29 ++++++++++++------------- src/api/database.ts | 46 ++++++++++++++++++++++++++++++++++++++++ 3 files changed, 61 insertions(+), 16 deletions(-) create mode 100644 src/api/database.ts diff --git a/src/Activator.tsx b/src/Activator.tsx index 87e1e80..70397fc 100644 --- a/src/Activator.tsx +++ b/src/Activator.tsx @@ -68,7 +68,7 @@ export const Activator: React.FC = ({ retriggerEngine, projectId: consts.global.apiKey, provider: ethereum, - // db, + db, toggleHighlight(): void { dappHero.highlightEnabled = !dappHero.highlightEnabled highlightDomElements(dappHero.highlightEnabled, domElements) diff --git a/src/ProvidersWrapper.tsx b/src/ProvidersWrapper.tsx index 95f99d7..47328ba 100644 --- a/src/ProvidersWrapper.tsx +++ b/src/ProvidersWrapper.tsx @@ -8,10 +8,11 @@ import * as consts from 'consts' import { DomElementsContext, EthereumContext } from 'contexts' import { EmitterProvider } from 'providers/EmitterProvider/provider' import { useWeb3Provider } from 'hooks' -import userbase from 'userbase-js' import { Activator } from './Activator' import { UserBase as UBase } from './components/userBase/UserBase' +import { DB } from './api/database' + export const ProvidersWrapper: React.FC = () => { // react hooks const [ configuration, setConfig ] = useState(null) @@ -27,21 +28,19 @@ export const ProvidersWrapper: React.FC = () => { // load serBase const [ db, setDB ] = useState(null) + console.log('ProvidersWrapper:React.FC -> db', db) useEffect(() => { - userbase.init({ appId: process.env.REACT_APP_USERBASE_APP_ID }).then((session) => { - userbase.deleteUser = null - userbase.purchaseSubscription = null - userbase.cancelSubscription = null - userbase.resumeSubscription = null - userbase.updatePaymentMethod = null - // SDK initialized successfully - if (session.user) { - // there is a valid active session - // console.log(session.user.username) - } - }).catch((e) => console.error(e)) + const makeDBConnection = async () => { + const db = await new DB({ appId: process.env.REACT_APP_USERBASE_APP_ID, projectId: consts.global.apiKey }) + setDB(db) + // db.init().then((session) => { + // setDB(db) + // console.log('The session: ', session) + // }).catch((e) => console.error(e)) + } + makeDBConnection() }, []) // load contracts effects only if not paused @@ -103,7 +102,7 @@ export const ProvidersWrapper: React.FC = () => { - + { supportedNetworks={supportedNetworks} domElementsFilteredForContracts={smartcontractElements.domElementsFilteredForContracts} contractElements={smartcontractElements.contractElements} - db={userbase} + db={db} /> diff --git a/src/api/database.ts b/src/api/database.ts new file mode 100644 index 0000000..471219c --- /dev/null +++ b/src/api/database.ts @@ -0,0 +1,46 @@ +import userbase from 'userbase-js' + +export class DB { + constructor({ appId, projectId }) { + this.projectId = projectId + userbase.init({ appId }) + } + + // async init(): Promise { + // return this.userbase.init({ appId: this.appId }) + // } + + async signUp(details): Promise { + return userbase.signUp(details) + } + + async signIn(details): Promise { + console.log('details', details) + return userbase.signIn({ ...details }) + } + + async signOut(): Promise { + return userbase.signOut() + } + + async forgotPassword(username): Promise { + return userbase.forgotPassword(username) + } + + async openDatabase(changeFunc): Promise { + return userbase.openDatabase({ databaseName: this.projectId, changeHandler: changeFunc }) + } + + async insertItem(item): Promise { + return userbase.insertItem({ databaseName: this.projectId, item }) + } + + async updateItem(item, itemId): Promise { + return userbase.updateItem({ databaseName: this.projectId, item, itemId }) + } + + async deleteItem(itemId): Promise { + return userbase.deleteItem({ databaseName: this.projectId, itemId }) + } + +} From 274170abfe3e5160fdd8857ba6ccb328b18cba86 Mon Sep 17 00:00:00 2001 From: Dennison Bertram Date: Mon, 15 Jun 2020 15:55:02 -0400 Subject: [PATCH 08/10] =?UTF-8?q?=F0=9F=90=9B=20FIX:=20=20Add=20types=20to?= =?UTF-8?q?=20DB=20class?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/ProvidersWrapper.tsx | 10 +++------- src/api/database.ts | 7 ++----- 2 files changed, 5 insertions(+), 12 deletions(-) diff --git a/src/ProvidersWrapper.tsx b/src/ProvidersWrapper.tsx index 47328ba..f72530a 100644 --- a/src/ProvidersWrapper.tsx +++ b/src/ProvidersWrapper.tsx @@ -28,19 +28,15 @@ export const ProvidersWrapper: React.FC = () => { // load serBase const [ db, setDB ] = useState(null) - console.log('ProvidersWrapper:React.FC -> db', db) useEffect(() => { const makeDBConnection = async () => { const db = await new DB({ appId: process.env.REACT_APP_USERBASE_APP_ID, projectId: consts.global.apiKey }) setDB(db) - // db.init().then((session) => { - // setDB(db) - // console.log('The session: ', session) - // }).catch((e) => console.error(e)) } - - makeDBConnection() + if (consts.global.apiKey) { + makeDBConnection() + } }, []) // load contracts effects only if not paused diff --git a/src/api/database.ts b/src/api/database.ts index 471219c..de66f4c 100644 --- a/src/api/database.ts +++ b/src/api/database.ts @@ -1,21 +1,18 @@ import userbase from 'userbase-js' export class DB { + projectId: string + constructor({ appId, projectId }) { this.projectId = projectId userbase.init({ appId }) } - // async init(): Promise { - // return this.userbase.init({ appId: this.appId }) - // } - async signUp(details): Promise { return userbase.signUp(details) } async signIn(details): Promise { - console.log('details', details) return userbase.signIn({ ...details }) } From dbbb922874cfb79a1655ac92b2e7b5de164a86ea Mon Sep 17 00:00:00 2001 From: Dennison Bertram Date: Mon, 15 Jun 2020 15:56:18 -0400 Subject: [PATCH 09/10] =?UTF-8?q?=F0=9F=91=8C=20IMPROVE:=20=20truncating?= =?UTF-8?q?=20code?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/ProvidersWrapper.tsx | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/ProvidersWrapper.tsx b/src/ProvidersWrapper.tsx index f72530a..a3518d0 100644 --- a/src/ProvidersWrapper.tsx +++ b/src/ProvidersWrapper.tsx @@ -31,8 +31,7 @@ export const ProvidersWrapper: React.FC = () => { useEffect(() => { const makeDBConnection = async () => { - const db = await new DB({ appId: process.env.REACT_APP_USERBASE_APP_ID, projectId: consts.global.apiKey }) - setDB(db) + setDB(await new DB({ appId: process.env.REACT_APP_USERBASE_APP_ID, projectId: consts.global.apiKey })) } if (consts.global.apiKey) { makeDBConnection() From c27c04cb40200776d8c116fe1f034db99d273c10 Mon Sep 17 00:00:00 2001 From: Dennison Bertram Date: Tue, 16 Jun 2020 14:48:06 -0400 Subject: [PATCH 10/10] =?UTF-8?q?=F0=9F=90=9B=20FIX:=20remove=20modal?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/ProvidersWrapper.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ProvidersWrapper.tsx b/src/ProvidersWrapper.tsx index a3518d0..cf7e3aa 100644 --- a/src/ProvidersWrapper.tsx +++ b/src/ProvidersWrapper.tsx @@ -97,7 +97,7 @@ export const ProvidersWrapper: React.FC = () => { - + {/* */}