Skip to content

Commit 4775d61

Browse files
committed
Add experimental automatic offline message. (closes #69)
1 parent 20ba6f5 commit 4775d61

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

src/registerServiceWorker.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,9 @@ if (process.env.NODE_ENV === "production") {
3434
console.log(
3535
"No internet connection found. App is running in offline mode."
3636
);
37+
document.dispatchEvent(
38+
new CustomEvent("sw-status", { detail: "offline" })
39+
);
3740
},
3841
error(error) {
3942
console.error("Error during service worker registration:", error);

src/store/client.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,9 @@ const actions = {
9797
commit("updateError", "");
9898
},
9999
swUpdate: ({ commit }, type) => {
100+
if (type == "offline") {
101+
commit("updateError", "Picto is offline.");
102+
}
100103
commit("swUpdate", type);
101104
}
102105
};

0 commit comments

Comments
 (0)