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
| function isJson (response) { | |
| const contentType = response.headers.get('content-type') | |
| return contentType && contentType.indexOf('application/json') !== -1 | |
| } | |
| export function handleResponse (response) { | |
| if (response.ok) { | |
| if (isJson(response)) { | |
| return response.json() | |
| } else { |
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
| #!/bin/bash | |
| if [[ "$1" != "" ]]; then | |
| S3BUCKETNAME="$1" | |
| else | |
| echo ERROR: Failed to supply S3 bucket name | |
| exit 1 | |
| fi | |
| aws s3 sync build s3://$S3BUCKETNAME --delete --cache-control max-age=31536000,public |
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
| deployment: | |
| prod: | |
| branch: master | |
| commands: | |
| - NODE_ENV=production yarn run build | |
| - ./bin/s3Sync.sh [s3 bucket name] | |
| staging: | |
| branch: staging | |
| commands: |
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
| // In production, we register a service worker to serve assets from local cache. | |
| // This lets the app load faster on subsequent visits in production, and gives | |
| // it offline capabilities. However, it also means that developers (and users) | |
| // will only see deployed updates on the "N+1" visit to a page, since previously | |
| // cached resources are updated in the background. | |
| // To learn more about the benefits of this model, read https://goo.gl/KwvDNy. | |
| // This link also includes instructions on opting out of this behavior. |
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
| import { createSelector } from 'reselect' | |
| // CONSTANTS | |
| export const UPDATE_SERVICEWORKER = 'UPDATE_SERVICEWORKER' | |
| export function updateServiceworker () { | |
| return { | |
| type: UPDATE_SERVICEWORKER | |
| } | |
| } |
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
| import React from 'react'; | |
| import ReactDOM from 'react-dom'; | |
| import { Provider } from 'react-redux'; | |
| import { updateServiceworker } from 'service-worker-redux' | |
| import configureStore from 'store/configure-store' | |
| import './index.css'; | |
| import App from './App'; | |
| import registerServiceWorker from './registerServiceWorker'; | |
| const store = configureStore() |
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
| componentWillReceiveProps (nextProps) { | |
| // see if new content was found by the service worker | |
| if (nextProps.serviceWorker.serviceWorkerUpdated) { | |
| this.setState({ | |
| notifications: this.state.notifications.concat({ | |
| 'The app has been updated! Hooray! Refresh your browser to enjoy the latest and greatest', | |
| 'some unique key', | |
| action: 'Dismiss', | |
| dismissAfter: 4000, | |
| onClick: this.removeNotification |
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
| // @flow | |
| import React from 'react' | |
| import classnames from 'classnames' | |
| import type { ButtonT } from './ButtonT' | |
| const Button = ({ className, type = 'button', text, tabIndex, onClick = () => {}, disabled = false }: ButtonT) => ( | |
| <button | |
| className={classnames('button', className)} | |
| type={type} |
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
| [{ | |
| id: 1234, | |
| title: 'test', | |
| view: 'two-column' | |
| }, | |
| { | |
| id: 1234, | |
| title: 'test', | |
| view: 'image-only' | |
| }] |
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
| import CacheClientPromise from 'cache-client-promise' | |
| const myCache = new CacheClientPromise(); | |
| [{ | |
| id: 1234, | |
| title: 'test', | |
| view: 'two-column' | |
| }, | |
| { |