Skip to content
This repository was archived by the owner on Mar 7, 2024. It is now read-only.

Commit c0efb4f

Browse files
Add success and failure page (#186)
* Add success and failure page * s * Update Failure.js * Update Success.js
1 parent ad623cf commit c0efb4f

File tree

3 files changed

+82
-0
lines changed

3 files changed

+82
-0
lines changed

src/Routes.js

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ import PrivacyView from './views/pages/documents/privacyView';
2222
import RefundView from './views/pages/documents/refundView';
2323
import ScrollReset from './components/ScrollReset';
2424
import coursesContent from 'src/data/courses';
25+
import Success from './views/pages/PaymentStatus/Success'
26+
import Cancelled from './views/pages/PaymentStatus/Failure'
2527

2628
const renderRoutes = () => (
2729
<Suspense fallback={<LoadingScreen />}>
@@ -109,6 +111,20 @@ const renderRoutes = () => (
109111
</MainLayout>
110112
)}
111113
/>
114+
<Route
115+
path="/success"
116+
exact
117+
render={props => (
118+
<Success />
119+
)}
120+
/>
121+
<Route
122+
path="/canceled"
123+
exact
124+
render={props => (
125+
<Cancelled />
126+
)}
127+
/>
112128
<Route
113129
path="/editProfile"
114130
exact
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
import { makeStyles, Typography } from '@material-ui/core';
2+
import React from 'react';
3+
import { Redirect } from 'react-router';
4+
5+
const useStyles = makeStyles(() => ({
6+
root: {
7+
marginTop: '49vh'
8+
}
9+
}));
10+
11+
export default function Success() {
12+
const classes = useStyles();
13+
14+
const [wait, removeWait] = React.useState(true);
15+
16+
setTimeout(
17+
function () {
18+
removeWait(false);
19+
},
20+
5000)
21+
22+
if (wait) {
23+
return (
24+
<div className={classes.root}>
25+
<Typography align="center" style={{color: 'red'}}>Your last payment to codeforcause was Failed. Redirecting to home page...</Typography>
26+
</div>
27+
);
28+
}
29+
30+
return (
31+
<Redirect to="/" />
32+
)
33+
}
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
import { makeStyles, Typography } from '@material-ui/core';
2+
import React from 'react';
3+
import { Redirect } from 'react-router';
4+
5+
const useStyles = makeStyles(() => ({
6+
root: {
7+
marginTop: '49vh'
8+
}
9+
}));
10+
11+
export default function Success() {
12+
const classes = useStyles();
13+
14+
const [wait, removeWait] = React.useState(true);
15+
16+
setTimeout(
17+
function () {
18+
removeWait(false);
19+
},
20+
5000)
21+
22+
if (wait) {
23+
return (
24+
<div className={classes.root}>
25+
<Typography align="center">Your last payment to codeforcause was successful. Redirecting to home page...</Typography>
26+
</div>
27+
);
28+
}
29+
30+
return (
31+
<Redirect to="/" />
32+
)
33+
}

0 commit comments

Comments
 (0)