Skip to content

Commit 9106dea

Browse files
author
Carlos Rufo
committed
update service worker index
1 parent 7a7a948 commit 9106dea

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

src/index.js

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,29 +2,29 @@ import React from 'react'
22
import ReactDOM from 'react-dom'
33
import './styles/index.css'
44
import App from './components/App'
5-
import registerServiceWorker from './registerServiceWorker'
5+
import * as serviceWorker from './serviceWorker'
66
import { ApolloProvider } from 'react-apollo'
77
import { ApolloClient } from 'apollo-client'
88
import { createHttpLink } from 'apollo-link-http'
99
import { InMemoryCache } from 'apollo-cache-inmemory'
1010
import { BrowserRouter } from 'react-router-dom'
11-
import { AUTH_TOKEN } from './constants'
1211
import { setContext } from 'apollo-link-context'
12+
import { AUTH_TOKEN } from './constants'
1313
import { split } from 'apollo-link'
1414
import { WebSocketLink } from 'apollo-link-ws'
1515
import { getMainDefinition } from 'apollo-utilities'
1616

1717
const httpLink = createHttpLink({
18-
uri: 'http://localhost:4000'
18+
uri: 'http://localhost:4000',
1919
})
2020

2121
const 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

4141
const 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

5050
const client = new ApolloClient({
5151
link,
52-
cache: new InMemoryCache()
52+
cache: new InMemoryCache(),
5353
})
5454

5555
ReactDOM.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

Comments
 (0)