Skip to content

Commit

Permalink
Offline support and service worker test
Browse files Browse the repository at this point in the history
  • Loading branch information
carlaiau committed Mar 20, 2020
1 parent ee04626 commit c1dfd15
Show file tree
Hide file tree
Showing 4 changed files with 667 additions and 5 deletions.
11 changes: 7 additions & 4 deletions client/gatsby-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,11 @@ module.exports = {
trackingId: "UA-61918855-18"
}
},
// this (optional) plugin enables Progressive Web App + Offline functionality
// To learn more, visit: https://gatsby.dev/offline
// `gatsby-plugin-offline`,
],
{
resolve: `gatsby-plugin-offline`,
options: {
precachePages: [`/*`]
}
}
]
}
5 changes: 4 additions & 1 deletion client/src/components/country-page.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import GridItem from "../components/grid-item"
import Footer from "../components/footer"
import GetTopCountries from '../utils/get-top-countries'
import SetupCountry from '../utils/setup-country'
import { navigate } from "@reach/router"

import 'bulma/css/bulma.css'
import '../styles/custom.css'
Expand Down Expand Up @@ -38,7 +39,9 @@ export default class CountryPage extends React.Component{
}

heroSelectFn = (e) => {
this.setState({selected_country: e.target.value})
// this.setState({selected_country: e.target.value})
if(e.target.value)
navigate(`/${e.target.value.toLowerCase().replace(/\s+/g, "-")}`)
}


Expand Down
5 changes: 5 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"dependencies": {
"gatsby-plugin-offline": "^3.0.42"
}
}
Loading

0 comments on commit c1dfd15

Please sign in to comment.