fix(sw) navigation error

This commit is contained in:
coderaiser 2018-09-10 11:00:04 +03:00
parent adbfb95012
commit c356bc76f4

View file

@ -6,6 +6,9 @@ const currify = require('currify/legacy');
const isDev = process.env.NODE_ENV === 'development';
const isGet = (a) => a.method === 'GET';
const isBasic = (a) => a.type === 'basic';
const wait = currify((f, e) => e.waitUntil(f()));
const respondWith = currify((f, e) => {
const {request} = e;
@ -18,6 +21,9 @@ const respondWith = currify((f, e) => {
if (!isGet(request))
return;
if (!isBasic(request))
return;
if (/^\/api/.test(pathname))
return;
@ -32,8 +38,6 @@ const getPathName = (url) => new URL(url).pathname;
const date = codegen`module.exports = '"' + Date() + '"'`;
const NAME = `cloudcmd: ${date}`;
const isGet = (a) => a.method === 'GET';
const createRequest = (a) => new Request(a, {
credentials: 'same-origin'
});