More things
This commit is contained in:
@@ -44,17 +44,22 @@ export function useArticleLibrary() {
|
||||
}
|
||||
|
||||
function put(key: string, article: ReaderArticle) {
|
||||
/* the one address a version answers to, whatever asked for it: the short
|
||||
/wiki/<slug> form fetches by document and the versioned form by
|
||||
(identity, language), and both are the same page of the shelf */
|
||||
const version = versionKey(identityOf(article), articleLanguage(article))
|
||||
delete unreadable.value[key]
|
||||
delete unreadable.value[versionKey(identityOf(article), article.language ?? 'en')]
|
||||
delete unreadable.value[version]
|
||||
shelf.value[key] = article
|
||||
/* a version also answers to its document's own slug, where it was fetched
|
||||
from and where the panes keep it */
|
||||
from and where the panes keep it, and to the version it is */
|
||||
shelf.value[article.slug] = article
|
||||
shelf.value[version] = article
|
||||
}
|
||||
|
||||
function forget(slug: string) {
|
||||
const article = shelf.value[slug]
|
||||
if (article) delete shelf.value[versionKey(identityOf(article), article.language ?? 'en')]
|
||||
if (article) delete shelf.value[versionKey(identityOf(article), articleLanguage(article))]
|
||||
delete shelf.value[slug]
|
||||
delete unreadable.value[slug]
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user