Created
November 12, 2019 22:12
-
-
Save metehansenol/34c3d0ba1707b4fe767cb70bddf55f8b to your computer and use it in GitHub Desktop.
Getting Customer Account Balance
This file contains hidden or 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
async componentDidUpdate(prevProps, prevState) { | |
const accountCode = this.props.accountCode; | |
if (accountCode !== prevProps.accountCode) { | |
let header = await Auth.header(); | |
const data = await fetch(`${global.bpmApiUrl}/logo-tedarikciler?cariHesapKodu=${accountCode}`, {headers: header}) | |
.then(response => response.json()); | |
if (data.length > 0) { | |
let balance = 0; | |
let moneySign = data[0].moneySign; | |
data.forEach(item => balance += item.muhasebeBakiye); | |
this.setState({ | |
balance, | |
moneySign | |
}); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment