feat: strictly typed resumed preferences

This commit is contained in:
Ayo 2023-07-16 20:24:34 +02:00
parent 664d81d86b
commit a8b5513f00
3 changed files with 7 additions and 6 deletions

8
package-lock.json generated
View file

@ -9,7 +9,7 @@
"version": "0.1.29",
"dependencies": {
"@astrojs/netlify": "^2.2.2",
"@ayco/astro-resume": "^0.0.7",
"@ayco/astro-resume": "^0.0.9",
"@extractus/article-extractor": "^7.2.15",
"astro-iconify": "^1.2.0",
"sass": "^1.62.1"
@ -244,9 +244,9 @@
}
},
"node_modules/@ayco/astro-resume": {
"version": "0.0.7",
"resolved": "https://registry.npmjs.org/@ayco/astro-resume/-/astro-resume-0.0.7.tgz",
"integrity": "sha512-uBH2XE6tsh3+NdseE1uKqXGZ+v1BbjwdZqp2L6L4rIfc0EzszDBiHAHVxp3PIJk0WwTyH6HxKRf5oRByDIIbuA==",
"version": "0.0.9",
"resolved": "https://registry.npmjs.org/@ayco/astro-resume/-/astro-resume-0.0.9.tgz",
"integrity": "sha512-oQCiUfBe7risOWAlaKzHwvTQEsRGMJw8zhfpsjRE+cTiQGz74v1BMq+sO/94VGu1/1KUukAlT91n6dPjPcAO0A==",
"dependencies": {
"astro": "^2.8.3"
}

View file

@ -10,7 +10,7 @@
},
"dependencies": {
"@astrojs/netlify": "^2.2.2",
"@ayco/astro-resume": "^0.0.7",
"@ayco/astro-resume": "^0.0.9",
"@extractus/article-extractor": "^7.2.15",
"astro-iconify": "^1.2.0",
"sass": "^1.62.1"

View file

@ -16,6 +16,7 @@ const {routerOutlet, skipSave = false} = Astro.props;
<script>
import {resume} from '@ayco/astro-resume';
import {Props} from './Library.astro';
import { getPostCard, renderPost } from '../utils/library'
const cache = await caches.open('cozy-reader');
let url= new URL(window.location.href);
@ -25,7 +26,7 @@ const {routerOutlet, skipSave = false} = Astro.props;
url = new URL(`${url.origin}/?url=${urlParam}`);
}
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)
if (!response && !skipSave && !includesAppURL) {