Allow hot-reload of config.json

This commit is contained in:
pfych 2025-04-20 15:30:05 +10:00
parent 31026a0d15
commit 9dfc790200
10 changed files with 90 additions and 51 deletions

View file

@ -0,0 +1,17 @@
import { languages, Manga } from '../types';
export const getMangaTitle = (manga: Manga) => {
const languageToUse = languages.find((lang) => manga.attributes.title[lang]);
if (languageToUse) {
return manga.attributes.title[languageToUse];
}
// If no language is found, use the first one returned by the API
const fallbackLanguage = Object.keys(manga.attributes.title)?.[0];
if (fallbackLanguage) {
return manga.attributes.title[fallbackLanguage] as string;
}
return 'UNKNOWN TITLE';
};