mirror of
https://codeberg.org/HPCesia/AstralHalo.git
synced 2025-04-08 17:34:27 +08:00
fix: getAllReferences.getArticle
This commit is contained in:
parent
6d41ef585a
commit
653a3cbd71
@ -167,15 +167,15 @@ export async function getAllReferences() {
|
||||
collection = 'posts';
|
||||
refPath = `posts/${refPath}`;
|
||||
}
|
||||
const { id, title } = pathMap[refPath];
|
||||
if (id) {
|
||||
if (collection === 'spec') {
|
||||
const article = specs.find((it) => it.id === id);
|
||||
if (article) return { title, collection, id };
|
||||
} else {
|
||||
const article = posts.find((it) => it.id === id);
|
||||
if (article) return { title, collection: 'posts', id };
|
||||
}
|
||||
const data = pathMap[refPath];
|
||||
if (!data) return null;
|
||||
const { id, title } = data;
|
||||
if (collection === 'spec') {
|
||||
const article = specs.find((it) => it.id === id);
|
||||
if (article) return { title, collection, id };
|
||||
} else {
|
||||
const article = posts.find((it) => it.id === id);
|
||||
if (article) return { title, collection: 'posts', id };
|
||||
}
|
||||
return null;
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user