-
Notifications
You must be signed in to change notification settings - Fork 21
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
1 parent
07b471d
commit 273a45f
Showing
7 changed files
with
71 additions
and
43 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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,59 +1,56 @@ | ||
//faking the API | ||
import React, { useEffect, useState } from 'react'; | ||
import React, { useEffect } from 'react'; | ||
import axios from 'axios'; | ||
|
||
const OKpage: React.FC = () => { | ||
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 | ||
// Mock function to simulate a successful API call | ||
const mockSend_MoneyAPI = async ( | ||
senderPhoneNumber: string, | ||
recipientPhoneNumber: string, | ||
amount: number | ||
) => { | ||
) => { | ||
try { | ||
const response = await api.post('/send_money', { | ||
senderPhoneNumber, | ||
recipientPhoneNumber, | ||
amount }); | ||
amount | ||
}); | ||
return response.data; | ||
} catch (error) { | ||
throw error; | ||
} | ||
} | ||
}; | ||
|
||
// Handle API call when component mounts | ||
// 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); | ||
}); | ||
.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="flex justify-center items-center p-10 mb-34 border border-white rounded-3xl bg--500 text-white"> | ||
<div className="card"> | ||
<div className="ok-page"> | ||
<h1>Success!</h1> | ||
<br></br> | ||
<p>The money was successfully transfered.</p> | ||
</div> | ||
<div className="mt-16"> | ||
return ( | ||
<div className="flex justify-center items-center p-10 mb-34 border border-white rounded-3xl bg--500 text-white"> | ||
<div className="card"> | ||
<div className="ok-page"> | ||
<h1>Success!</h1> | ||
<br /> | ||
<p>The money was successfully transferred.</p> | ||
</div> | ||
<div className="mt-16"> | ||
<button className="w-96 mt-16 bg-Gray10-color rounded-3xl p-2 text-center text-white bg-green-500">OK</button> | ||
</div> | ||
</div> | ||
</div> | ||
); | ||
}; | ||
|
||
export default OKPage; | ||
</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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,51 @@ | ||
import { VitePWA } from 'vite-plugin-pwa' | ||
import { defineConfig } from 'vite' | ||
import react from '@vitejs/plugin-react' | ||
|
||
// https://vitejs.dev/config/ | ||
import { defineConfig } from 'vite'; | ||
import react from '@vitejs/plugin-react'; | ||
import { VitePWA } from 'vite-plugin-pwa'; | ||
|
||
export default defineConfig({ | ||
plugins: [react(), | ||
plugins: [ | ||
react(), | ||
VitePWA({ | ||
injectRegister: 'auto', | ||
registerType: 'autoUpdate', | ||
registerType: 'autoUpdate', | ||
workbox: { | ||
clientsClaim: true, | ||
skipWaiting: true, | ||
globPatterns: ['**/*.{ts,css,html,}'] | ||
globPatterns: ['**/*.{js,css,html,png,svg,ico}'], | ||
}, | ||
devOptions: { | ||
enabled: true, | ||
type: 'module', | ||
}, | ||
}) | ||
includeAssets: ['favicon.ico', 'apple-touch-icon.png', 'mask-icon.svg'], | ||
manifest: { | ||
name: 'PPA', | ||
short_name: 'PPA', | ||
theme_color: '#ffffff', | ||
icons: [ | ||
{ | ||
src: '/public/icon36x36.png', | ||
sizes: '36x36', | ||
type: 'image/png', | ||
}, | ||
{ | ||
src: '/public/icon48x48.png', | ||
sizes: '48x48', | ||
type: 'image/png', | ||
}, | ||
{ | ||
src: '/public/icon310x310.png', | ||
sizes: '310x310', | ||
type: 'image/png', | ||
purpose: 'any', | ||
}, | ||
{ | ||
src: '/public/icon144x144.png', | ||
sizes: '144x144', | ||
type: 'image/png', | ||
purpose: 'maskable', | ||
}, | ||
], | ||
}, | ||
}), | ||
], | ||
}) | ||
}); |