🔧(frontend) remove deprecated routes and update service worker
- Removed the versioning route from the default configuration to streamline the documentation structure. - Updated the service worker to eliminate references to the deprecated versioning fallback, enhancing the offline experience for users.
This commit is contained in:
committed by
Anthony LC
parent
a8a89def98
commit
42d9fa70a2
@@ -9,10 +9,6 @@ server {
|
|||||||
try_files $uri index.html $uri/ =404;
|
try_files $uri index.html $uri/ =404;
|
||||||
}
|
}
|
||||||
|
|
||||||
location ~ ^/docs/(.*)/versions/(.*)/$ {
|
|
||||||
error_page 404 /docs/[id]/versions/[versionId]/;
|
|
||||||
}
|
|
||||||
|
|
||||||
location /docs/ {
|
location /docs/ {
|
||||||
error_page 404 /docs/[id]/;
|
error_page 404 /docs/[id]/;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -91,7 +91,6 @@ self.addEventListener('activate', function (event) {
|
|||||||
const FALLBACK = {
|
const FALLBACK = {
|
||||||
offline: '/offline/',
|
offline: '/offline/',
|
||||||
docs: '/docs/[id]/',
|
docs: '/docs/[id]/',
|
||||||
versions: '/docs/[id]/versions/[versionId]/',
|
|
||||||
images: '/assets/img-not-found.svg',
|
images: '/assets/img-not-found.svg',
|
||||||
};
|
};
|
||||||
const precacheResources = [
|
const precacheResources = [
|
||||||
@@ -104,7 +103,6 @@ const precacheResources = [
|
|||||||
FALLBACK.offline,
|
FALLBACK.offline,
|
||||||
FALLBACK.images,
|
FALLBACK.images,
|
||||||
FALLBACK.docs,
|
FALLBACK.docs,
|
||||||
FALLBACK.versions,
|
|
||||||
];
|
];
|
||||||
|
|
||||||
const precacheStrategy = getStrategy({
|
const precacheStrategy = getStrategy({
|
||||||
@@ -125,12 +123,6 @@ setCatchHandler(async ({ request, url, event }) => {
|
|||||||
case request.destination === 'document':
|
case request.destination === 'document':
|
||||||
if (url.pathname.match(/^\/docs\/([a-z0-9\-]+)\/$/g)) {
|
if (url.pathname.match(/^\/docs\/([a-z0-9\-]+)\/$/g)) {
|
||||||
return precacheStrategy.handle({ event, request: FALLBACK.docs });
|
return precacheStrategy.handle({ event, request: FALLBACK.docs });
|
||||||
} else if (
|
|
||||||
url.pathname.match(
|
|
||||||
/^\/docs\/([a-z0-9\-]+)\/versions\/([a-z0-9\-]+)\/$/g,
|
|
||||||
)
|
|
||||||
) {
|
|
||||||
return precacheStrategy.handle({ event, request: FALLBACK.versions });
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return precacheStrategy.handle({ event, request: FALLBACK.offline });
|
return precacheStrategy.handle({ event, request: FALLBACK.offline });
|
||||||
|
|||||||
@@ -1,13 +0,0 @@
|
|||||||
import { NextPageWithLayout } from '@/types/next';
|
|
||||||
|
|
||||||
import { DocLayout } from '../index';
|
|
||||||
|
|
||||||
const Page: NextPageWithLayout = () => {
|
|
||||||
return null;
|
|
||||||
};
|
|
||||||
|
|
||||||
Page.getLayout = function getLayout() {
|
|
||||||
return <DocLayout />;
|
|
||||||
};
|
|
||||||
|
|
||||||
export default Page;
|
|
||||||
@@ -1,13 +0,0 @@
|
|||||||
import { NextPageWithLayout } from '@/types/next';
|
|
||||||
|
|
||||||
import { DocLayout } from '../index';
|
|
||||||
|
|
||||||
const Page: NextPageWithLayout = () => {
|
|
||||||
return null;
|
|
||||||
};
|
|
||||||
|
|
||||||
Page.getLayout = function getLayout() {
|
|
||||||
return <DocLayout />;
|
|
||||||
};
|
|
||||||
|
|
||||||
export default Page;
|
|
||||||
Reference in New Issue
Block a user