change get contact code to new api
This commit is contained in:
parent
b3c7459cbe
commit
6b2e751ba8
|
@ -8,9 +8,6 @@ import { isNil } from 'lodash'
|
||||||
|
|
||||||
const { receiveAccounts, receiveStatusContactCode } = accountActions
|
const { receiveAccounts, receiveStatusContactCode } = accountActions
|
||||||
const CONTACT_CODE = 'CONTACT_CODE'
|
const CONTACT_CODE = 'CONTACT_CODE'
|
||||||
const STATUS_API_REQUEST = 'STATUS_API_REQUEST'
|
|
||||||
const hasContactCode = () => !isNil(STATUS_API) && !isNil(STATUS_API[CONTACT_CODE])
|
|
||||||
const statusApiSuccess = event => event.detail.permissions[0] === CONTACT_CODE
|
|
||||||
const getContactCode = event => event.detail.data[CONTACT_CODE]
|
const getContactCode = event => event.detail.data[CONTACT_CODE]
|
||||||
|
|
||||||
export const fetchAndDispatchAccountsWithBalances = (web3, dispatch) => {
|
export const fetchAndDispatchAccountsWithBalances = (web3, dispatch) => {
|
||||||
|
@ -29,14 +26,14 @@ export const fetchAndDispatchAccountsWithBalances = (web3, dispatch) => {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
export const checkAndDispatchStatusContactCode = dispatch => {
|
export const checkAndDispatchStatusContactCode = dispatch => {
|
||||||
window.addEventListener('statusapi', function (event) {
|
window.web3.currentProvider.status
|
||||||
if (statusApiSuccess(event)) dispatch(receiveStatusContactCode(getContactCode(event)))
|
.getContactCode()
|
||||||
});
|
.then(data => {
|
||||||
|
dispatch(receiveStatusContactCode(getContactCode(data)));
|
||||||
setTimeout(
|
})
|
||||||
() => { window.postMessage({ type: STATUS_API_REQUEST, permissions: ["CONTACT_CODE", "CONTACTS"] }, '*') },
|
.catch(err => {
|
||||||
1000
|
console.log('Error:', err);
|
||||||
)
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
export const fetchAndDispatchSNTAllowance = dispatch => {
|
export const fetchAndDispatchSNTAllowance = dispatch => {
|
||||||
|
|
Loading…
Reference in New Issue