@@ -2,29 +2,29 @@ import React from 'react'
22import ReactDOM from 'react-dom'
33import './styles/index.css'
44import App from './components/App'
5- import registerServiceWorker from './registerServiceWorker '
5+ import * as serviceWorker from './serviceWorker '
66import { ApolloProvider } from 'react-apollo'
77import { ApolloClient } from 'apollo-client'
88import { createHttpLink } from 'apollo-link-http'
99import { InMemoryCache } from 'apollo-cache-inmemory'
1010import { BrowserRouter } from 'react-router-dom'
11- import { AUTH_TOKEN } from './constants'
1211import { setContext } from 'apollo-link-context'
12+ import { AUTH_TOKEN } from './constants'
1313import { split } from 'apollo-link'
1414import { WebSocketLink } from 'apollo-link-ws'
1515import { getMainDefinition } from 'apollo-utilities'
1616
1717const httpLink = createHttpLink ( {
18- uri : 'http://localhost:4000'
18+ uri : 'http://localhost:4000' ,
1919} )
2020
2121const authLink = setContext ( ( _ , { headers } ) => {
2222 const token = localStorage . getItem ( AUTH_TOKEN )
2323 return {
2424 headers : {
2525 ...headers ,
26- authorization : token ? `Bearer ${ token } ` : ''
27- }
26+ authorization : token ? `Bearer ${ token } ` : '' ,
27+ } ,
2828 }
2929} )
3030
@@ -33,9 +33,9 @@ const wsLink = new WebSocketLink({
3333 options : {
3434 reconnect : true ,
3535 connectionParams : {
36- authToken : localStorage . getItem ( AUTH_TOKEN )
37- }
38- }
36+ authToken : localStorage . getItem ( AUTH_TOKEN ) ,
37+ } ,
38+ } ,
3939} )
4040
4141const link = split (
@@ -44,12 +44,12 @@ const link = split(
4444 return kind === 'OperationDefinition' && operation === 'subscription'
4545 } ,
4646 wsLink ,
47- authLink . concat ( httpLink )
47+ authLink . concat ( httpLink ) ,
4848)
4949
5050const client = new ApolloClient ( {
5151 link,
52- cache : new InMemoryCache ( )
52+ cache : new InMemoryCache ( ) ,
5353} )
5454
5555ReactDOM . render (
@@ -58,6 +58,6 @@ ReactDOM.render(
5858 < App />
5959 </ ApolloProvider >
6060 </ BrowserRouter > ,
61- document . getElementById ( 'root' )
61+ document . getElementById ( 'root' ) ,
6262)
63- registerServiceWorker ( )
63+ serviceWorker . unregister ( )
0 commit comments