-
Notifications
You must be signed in to change notification settings - Fork 504
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Philip London
committed
Jan 22, 2020
1 parent
276bb00
commit ea33585
Showing
14 changed files
with
167 additions
and
79 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 2 additions & 0 deletions
2
packages/blockchain-wallet-v4-frontend/src/data/components/borrow/model.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,3 @@ | ||
export const INVALID_COIN_TYPE = 'Invalid coin type' | ||
|
||
export const NO_OFFER_EXISTS = 'NO_OFFER_EXISTS' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 5 additions & 2 deletions
7
packages/blockchain-wallet-v4-frontend/src/data/components/borrow/sagaRegister.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,16 @@ | ||
import * as AT from './actionTypes' | ||
import { takeLatest } from 'redux-saga/effects' | ||
import { actionTypes } from 'redux-form' | ||
import { takeEvery, takeLatest } from 'redux-saga/effects' | ||
import sagas from './sagas' | ||
|
||
export default ({ api, coreSagas, networks }) => { | ||
const borrowSagas = sagas({ api, coreSagas, networks }) | ||
|
||
return function * borrowSaga () { | ||
return function* borrowSaga () { | ||
yield takeLatest(AT.CREATE_BORROW, borrowSagas.createBorrow) | ||
yield takeLatest(AT.FETCH_BORROW_OFFERS, borrowSagas.fetchBorrowOffers) | ||
yield takeLatest(AT.INITIALIZE_BORROW, borrowSagas.initializeBorrow) | ||
yield takeLatest(AT.MAX_COLLATERAL_CLICK, borrowSagas.maxCollateralClick) | ||
yield takeEvery(actionTypes.CHANGE, borrowSagas.formChanged) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 15 additions & 0 deletions
15
packages/blockchain-wallet-v4-frontend/src/data/components/borrow/selectors.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,18 @@ | ||
import { INVALID_COIN_TYPE } from './model' | ||
import { RootState } from '../../rootReducer' | ||
import { selectors } from 'data' | ||
|
||
export const getCoinType = (state: RootState) => state.components.borrow.coin | ||
|
||
export const getPayment = (state: RootState) => state.components.borrow.payment | ||
|
||
export const getRates = (state: RootState) => { | ||
const coinType = getCoinType(state) | ||
|
||
switch (coinType) { | ||
case 'BTC': | ||
return selectors.core.data.btc.getRates(state) | ||
default: | ||
throw new Error(INVALID_COIN_TYPE) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.