Skip to content

Commit bbbf5ad

Browse files
committed
Add package to /paypal route
1 parent 72d9da5 commit bbbf5ad

File tree

2 files changed

+13
-5
lines changed

2 files changed

+13
-5
lines changed

src/components/App.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,10 @@ class App extends Component {
3636
<div className="App">
3737
<Switch>
3838
<Route exact path="/" render={() => <Landing {...authProps} />} />
39-
<Route path="/paypal" render={() => <Paypal {...authProps} />} />
39+
<Route
40+
path="/paypal/:package?"
41+
render={() => <Paypal {...authProps} />}
42+
/>
4043
<Route
4144
exact
4245
path="/welcome"

src/components/landing/Paypal.js

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,19 @@
11
import React from 'react'
22
import { withRouter } from 'react-router'
3+
import get from 'lodash/get'
34

45
import './Paypal.css'
56
import { getPackage, calculateTeamPrice } from '../../lib/packages'
67
import CurrentUser from '../CurrentUser'
78
import Emoji from './Emoji'
89
import LinkNewTab from './LinkNewTab'
910

10-
const Paypal = ({ user, login, loading, location }) => {
11-
let { key, name, price } =
12-
(location.state && location.state.packageInfo) || getPackage('full')
11+
const Paypal = ({ user, login, loading, location, match }) => {
12+
const packageInfo =
13+
get(location, 'state.packageInfo') ||
14+
getPackage(match.params.package || 'full')
15+
16+
let { key, name, price } = packageInfo
1317

1418
if (key === 'team') {
1519
price = calculateTeamPrice(location.state.licenses)
@@ -28,7 +32,8 @@ const Paypal = ({ user, login, loading, location }) => {
2832
</p>
2933
<p style={{ textAlign: 'center' }}>
3034
<LinkNewTab href={`https://www.paypal.me/graphqlguide/${price}`}>
31-
paypal.me/graphqlguide/{price}
35+
paypal.me/graphqlguide/
36+
{price}
3237
</LinkNewTab>
3338
</p>
3439
<div className="Paypal-step2">

0 commit comments

Comments
 (0)