feat: strictly typed resumed preferences
This commit is contained in:
parent
664d81d86b
commit
a8b5513f00
3 changed files with 7 additions and 6 deletions
8
package-lock.json
generated
8
package-lock.json
generated
|
@ -9,7 +9,7 @@
|
||||||
"version": "0.1.29",
|
"version": "0.1.29",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@astrojs/netlify": "^2.2.2",
|
"@astrojs/netlify": "^2.2.2",
|
||||||
"@ayco/astro-resume": "^0.0.7",
|
"@ayco/astro-resume": "^0.0.9",
|
||||||
"@extractus/article-extractor": "^7.2.15",
|
"@extractus/article-extractor": "^7.2.15",
|
||||||
"astro-iconify": "^1.2.0",
|
"astro-iconify": "^1.2.0",
|
||||||
"sass": "^1.62.1"
|
"sass": "^1.62.1"
|
||||||
|
@ -244,9 +244,9 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@ayco/astro-resume": {
|
"node_modules/@ayco/astro-resume": {
|
||||||
"version": "0.0.7",
|
"version": "0.0.9",
|
||||||
"resolved": "https://registry.npmjs.org/@ayco/astro-resume/-/astro-resume-0.0.7.tgz",
|
"resolved": "https://registry.npmjs.org/@ayco/astro-resume/-/astro-resume-0.0.9.tgz",
|
||||||
"integrity": "sha512-uBH2XE6tsh3+NdseE1uKqXGZ+v1BbjwdZqp2L6L4rIfc0EzszDBiHAHVxp3PIJk0WwTyH6HxKRf5oRByDIIbuA==",
|
"integrity": "sha512-oQCiUfBe7risOWAlaKzHwvTQEsRGMJw8zhfpsjRE+cTiQGz74v1BMq+sO/94VGu1/1KUukAlT91n6dPjPcAO0A==",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"astro": "^2.8.3"
|
"astro": "^2.8.3"
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@astrojs/netlify": "^2.2.2",
|
"@astrojs/netlify": "^2.2.2",
|
||||||
"@ayco/astro-resume": "^0.0.7",
|
"@ayco/astro-resume": "^0.0.9",
|
||||||
"@extractus/article-extractor": "^7.2.15",
|
"@extractus/article-extractor": "^7.2.15",
|
||||||
"astro-iconify": "^1.2.0",
|
"astro-iconify": "^1.2.0",
|
||||||
"sass": "^1.62.1"
|
"sass": "^1.62.1"
|
||||||
|
|
|
@ -16,6 +16,7 @@ const {routerOutlet, skipSave = false} = Astro.props;
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import {resume} from '@ayco/astro-resume';
|
import {resume} from '@ayco/astro-resume';
|
||||||
|
import {Props} from './Library.astro';
|
||||||
import { getPostCard, renderPost } from '../utils/library'
|
import { getPostCard, renderPost } from '../utils/library'
|
||||||
const cache = await caches.open('cozy-reader');
|
const cache = await caches.open('cozy-reader');
|
||||||
let url= new URL(window.location.href);
|
let url= new URL(window.location.href);
|
||||||
|
@ -25,7 +26,7 @@ const {routerOutlet, skipSave = false} = Astro.props;
|
||||||
url = new URL(`${url.origin}/?url=${urlParam}`);
|
url = new URL(`${url.origin}/?url=${urlParam}`);
|
||||||
}
|
}
|
||||||
const response = await cache.match(url);
|
const response = await cache.match(url);
|
||||||
const {routerOutlet, skipSave} = resume('preferences') as any;
|
const {routerOutlet, skipSave} = resume<Props>('preferences');
|
||||||
const includesAppURL = urlParam?.includes(window.location.origin)
|
const includesAppURL = urlParam?.includes(window.location.origin)
|
||||||
|
|
||||||
if (!response && !skipSave && !includesAppURL) {
|
if (!response && !skipSave && !includesAppURL) {
|
||||||
|
|
Loading…
Reference in a new issue