forked from ADORSYS-GIS/e2e-banking-app
-
Notifications
You must be signed in to change notification settings - Fork 0
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
Showing
5 changed files
with
156 additions
and
32 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
//faking the API | ||
import React, { useEffect, useState } from 'react'; | ||
import axios from 'axios'; | ||
|
||
const OKpage: React.FC = () => { | ||
const baseURL = 'http://localhost:5000'; // specifying the base URL with the desired port | ||
const api = axios.create({ | ||
baseURL, | ||
timeout: 5000, | ||
}); | ||
|
||
// Mock function to simulate a succesful API call | ||
const mockSend_MoneyAPI = async ( | ||
senderPhoneNumber: string, | ||
recipientPhoneNumber: string, | ||
amount: number | ||
) => { | ||
try { | ||
const response = await api.post('/send_money', { | ||
senderPhoneNumber, | ||
recipientPhoneNumber, | ||
amount }); | ||
return response.data; | ||
} catch (error) { | ||
throw error; | ||
} | ||
} | ||
|
||
// Handle API call when component mounts | ||
useEffect(() => { | ||
mockSend_MoneyAPI('12347656', '1234567890', 100) | ||
.then((response) => { | ||
console.log("Mock API Response", response); | ||
}) | ||
.catch((error) => { | ||
console.error("Mock API Error", error); | ||
}); | ||
}, []); | ||
} | ||
|
||
|
||
//building the ok page for successful transfer | ||
const OKPage = () => { | ||
return ( | ||
<div className="card"> | ||
<div className="ok-page"> | ||
<h1>Success!</h1> | ||
<br></br> | ||
<p>The money was successfully transfered.</p> | ||
<br></br> | ||
</div> | ||
<button className ="okbtn">OK</button> | ||
</div> | ||
); | ||
}; | ||
|
||
export default OKPage; |
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 was deleted.
Oops, something went wrong.