This file contains hidden or 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
// IMPORTANT! The order must be the same as following. | |
// 1. | |
npm run build | |
// When running 'npm run build', GatsbyJS will run: 'npm run clean' && 'gatsby build' | |
// 2. | |
aws s3 sync ./public/ s3://thedevelopark.com --delete |
This file contains hidden or 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
version: 0.2 | |
phases: | |
install: | |
runtime-versions: | |
nodejs: 10 | |
pre_build: | |
commands: | |
- echo Removing objects in the S3 bucket... | |
- aws s3 rm s3://thedevelopark.com --recursive |
This file contains hidden or 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
version: 0.2 | |
phases: | |
install: | |
runtime-versions: | |
nodejs: 10 | |
commands: | |
- echo Installing Gatsby and Gatsby-CLI... | |
- npm install -g gatsby | |
- npm install -g gatsby-cli |
This file contains hidden or 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
aws s3 sync ./public/ s3://thedevelopark.com --delete | |
// "thedevelopark.com" must to changed to your bucket name. |
This file contains hidden or 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
// DELETE request with fetch => 4 lines | |
fetch(`${process.env.REACT_APP_HOST}/api/v1/users/${decoded.user_id}`, { | |
method: "DELETE", | |
headers: { Authorization: `Bearer ${ token }` } | |
}) | |
.catch(() => alert('Error Message')); | |
// DELETE request with axios => 3 lines | |
axios.delete(`${process.env.REACT_APP_HOST}/api/v1/users/${decoded.user_id}`, { | |
headers: { Authorization: `Bearer ${token}` } |
This file contains hidden or 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
// POST request with fetch => 13 lines | |
fetch(`${process.env.REACT_APP_HOST}/api/v1/login`, { | |
method: "POST", | |
headers: { | |
"Content-Type": "application/json", | |
Accept: "application/json" | |
}, | |
body: JSON.stringify({ | |
user: { | |
username: username, |
This file contains hidden or 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
// GET request with fetch => 4 lines | |
fetch(`${process.env.REACT_APP_HOST}/api/v1/profile`, { | |
method: "GET", | |
headers: { Authorization: `Bearer ${ token }` } | |
}) | |
// Regular fetch request doesn't automatically turn 'response' to json format. | |
// Thus, .json() is required. | |
.then(r => r.json()) | |
// GET request with axios => 3 lines |
This file contains hidden or 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
// PATCH request with Fetch => 11 lines | |
fetch(`${process.env.REACT_APP_HOST}/api/v1/users/${decoded.user_id}`, { | |
method: "PATCH", | |
headers: { | |
"Content-Type": "application/json", | |
Accept: "application/json", | |
Authorization: `Bearer ${token}` | |
}, | |
body: JSON.stringify({ | |
user: { password: newPW } |
This file contains hidden or 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
// Pass down .searchProducts() only if products are fetched from the backend. | |
{this.props.products.length ? ( | |
<ProductContainer products={this.searchProducts()} /> | |
) : null} |
This file contains hidden or 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
// **************** SEARCH Filter **************** | |
searchProducts = () => { | |
const filteredProducts = this.multiPropsFilter( | |
this.props.products, | |
this.filteredCollected() | |
); | |
return filteredProducts.filter(product => { | |
return product.name | |
.toLowerCase() | |
.includes(this.state.passingTags.search.inputTerm); |
NewerOlder