Skip to content
This repository was archived by the owner on Dec 24, 2022. It is now read-only.

Commit 7a3b2fe

Browse files
without custom code, CRA service doing cache work
1 parent edd02fc commit 7a3b2fe

File tree

4 files changed

+6
-5
lines changed

4 files changed

+6
-5
lines changed

public/index.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
To begin the development, run `npm start` or `yarn start`.
3737
To create a production bundle, use `npm run build` or `yarn build`.
3838
--></body>
39-
<script>
39+
<!-- <script>
4040
if ('serviceWorker' in navigator) {
4141
window.addEventListener('load', () => {
4242
console.log('serviceWorker custom');
@@ -46,5 +46,5 @@
4646
.catch((err) => console.log('Failure: ', err));
4747
});
4848
}
49-
</script>
49+
</script> -->
5050
</html>

public/my-serviceworker.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,9 @@ const CACHE_NAME = 'version-1';
22
const urlsToCache = [
33
'index.html',
44
'offline.html',
5-
'https://todo-restapi-app.herokuapp.com/api/todos?all=true',
5+
'https://todo-restapi-app.herokuapp.com/api/todos',
66
'/todo',
7+
'https://todo-restapi-app.herokuapp.com/api/',
78
];
89

910
const self = this;

public/offline.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<head>
44
<meta charset="UTF-8" />
55
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
6-
<title>Weather App</title>
6+
<title>Todo App</title>
77
<style type="text/css">
88
html {
99
height: 100%;

src/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,4 @@ ReactDOM.render(
2121
// If you want your app to work offline and load faster, you can change
2222
// unregister() to register() below. Note this comes with some pitfalls.
2323
// Learn more about service workers: https://bit.ly/CRA-PWA
24-
serviceWorker.unregister();
24+
serviceWorker.register();

0 commit comments

Comments
 (0)