refactor: update usage of @ayco/astro-resume

This commit is contained in:
Ayo 2023-07-16 22:01:16 +02:00
parent a8b5513f00
commit 2e574e289f
3 changed files with 9 additions and 9 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.9",
"@ayco/astro-resume": "^0.1.2",
"@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.9",
"resolved": "https://registry.npmjs.org/@ayco/astro-resume/-/astro-resume-0.0.9.tgz",
"integrity": "sha512-oQCiUfBe7risOWAlaKzHwvTQEsRGMJw8zhfpsjRE+cTiQGz74v1BMq+sO/94VGu1/1KUukAlT91n6dPjPcAO0A==",
"version": "0.1.2",
"resolved": "https://registry.npmjs.org/@ayco/astro-resume/-/astro-resume-0.1.2.tgz",
"integrity": "sha512-IrlDt7di37C8pyJdxy9wAyTGaup4OUWAtaVAT7uj6TQznkfCNgZtPuzO1fwTgb+MB66ymIL3o+LLFDfTCppSgw==",
"dependencies": {
"astro": "^2.8.3"
}

View file

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

View file

@ -1,5 +1,5 @@
---
import Resumable from '@ayco/astro-resume';
import Serialize from '@ayco/astro-resume';
export interface Props {
routerOutlet: string,
skipSave?: boolean
@ -12,10 +12,10 @@ const {routerOutlet, skipSave = false} = Astro.props;
<ul id="post-list"></ul>
</div>
<Resumable id="preferences" data={{routerOutlet, skipSave}} />
<Serialize id="preferences" data={{routerOutlet, skipSave}} />
<script>
import {resume} from '@ayco/astro-resume';
import {deserialize} from '@ayco/astro-resume';
import {Props} from './Library.astro';
import { getPostCard, renderPost } from '../utils/library'
const cache = await caches.open('cozy-reader');
@ -26,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<Props>('preferences');
const {routerOutlet, skipSave} = deserialize<Props>('preferences');
const includesAppURL = urlParam?.includes(window.location.origin)
if (!response && !skipSave && !includesAppURL) {