Skip to content

Commit

Permalink
Merge pull request #77 from Shehan-lakshitha/74-bill-payment
Browse files Browse the repository at this point in the history
bug fix
  • Loading branch information
Shehan-lakshitha authored Apr 7, 2024
2 parents a17c5e2 + 467b18b commit 5e08652
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 23 deletions.
10 changes: 9 additions & 1 deletion backend/routes/addUsers.js
Original file line number Diff line number Diff line change
Expand Up @@ -150,11 +150,19 @@ const uDetails=async(req,res)=>{
}
const Transferdetails=async(req,res)=>{
const {phoneNumber}=req.body
console.log(phoneNumber)
try {
const user=await User.findOne({phoneNumber})
res.send(user)
if(user){
console.log(true)
res.send({success:true,id:user._id})
}else{
res.send({success:false})
}

} catch (error) {
console.log(error)
res.send({success:false})
}
}
router.post('/adduser',addUser)
Expand Down
6 changes: 4 additions & 2 deletions frontend/src/constants/URL.js
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
//export const URL='http://192.168.8.159:5000'
export const URL='http://10.0.2.2:5000'
export const URL='http://192.168.43.199:5000'
//export const URL='http://10.0.2.2:5000'


2 changes: 1 addition & 1 deletion frontend/src/screens/QRSuccess.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ import { URL } from '../constants/URL';
});
if(response.data.success===true){
navigation.navigate('Home', {email:data.email,id:data._id});
console.log('fuck')

}
} catch (error) {
console.log(error)
Expand Down
38 changes: 21 additions & 17 deletions frontend/src/screens/Transfer.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,25 +20,29 @@ const Transfer = () => {


const handleFetchUser=async ()=>{
if(!phoneNumber && !amount){
try {
const response = await axios.post(`${URL}/api/transferdetails`,{phoneNumber:parseInt(phoneNumber)});

if(response.data.success===true){
console.log(response.data)
navigation.navigate('QRVerify',{data:userData,amount:amount,id:response.data.id})
}else if(response.data.success===false){
Toast.show({
type: 'error',
text1: 'Enter details',
text2: 'Please enter the phone number and amount',
});
}else{
try {
const response = await axios.post(`${URL}/api/transferdetails`,{phoneNumber:parseInt(phoneNumber)});

if(response){
console.log(response.data)
navigation.navigate('QRVerify',{data:userData,amount:amount,id:response.data._id})
}


} catch (error) {
console.log(error)
}
text1: 'Invalid Phone number',
text2: 'Please enter a valid phone number',
})
}


} catch (error) {
console.log(error)
Toast.show({
type: 'error',
text1: 'Invalid Phone number',
text2: 'Please enter a valid phone number',
})

}

}
Expand Down
4 changes: 2 additions & 2 deletions frontend/src/screens/Wallet.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -169,11 +169,11 @@ const Wallet = () => {



<View>
{/* <View>
<Text style={styles.recentTransactions}>Recent Transactions</Text>
<View style={styles.line}></View>
<Text style={styles.transText}>No Recent Transactions</Text>
</View>
</View> */}
</View>
</View>
);
Expand Down

0 comments on commit 5e08652

Please sign in to comment.