mirror of
https://github.com/upscayl/upscayl.git
synced 2024-11-27 17:00:52 +01:00
Fix news fetchinbg
This commit is contained in:
parent
192d23b591
commit
041a3c9ea7
@ -219,16 +219,20 @@ const Home = () => {
|
|||||||
|
|
||||||
// FETCH NEWS
|
// FETCH NEWS
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
fetch("https://raw.githubusercontent.com/upscayl/upscayl/main/news.md")
|
fetch("https://raw.githubusercontent.com/upscayl/upscayl/main/news.md", {
|
||||||
.then((res) => {
|
cache: "no-cache",
|
||||||
return res.blob();
|
|
||||||
})
|
})
|
||||||
.then(async (data) => {
|
.then((res) => {
|
||||||
const newsData = await data.text();
|
return res.text();
|
||||||
if (!newsData) return;
|
})
|
||||||
|
.then((result) => {
|
||||||
|
const newsData = result;
|
||||||
|
if (!newsData) {
|
||||||
|
console.log("📰 Could not fetch news data");
|
||||||
|
return;
|
||||||
|
}
|
||||||
const markdownData = matter(newsData);
|
const markdownData = matter(newsData);
|
||||||
console.log("🚀 => file: index.tsx:229 => markdownData:", markdownData);
|
if (!markdownData) return;
|
||||||
console.log("🚀 => file: index.tsx:229 => news:", news);
|
|
||||||
|
|
||||||
if (
|
if (
|
||||||
markdownData &&
|
markdownData &&
|
||||||
@ -239,7 +243,7 @@ const Home = () => {
|
|||||||
if (showNewsModal === false) {
|
if (showNewsModal === false) {
|
||||||
setShowNewsModal(false);
|
setShowNewsModal(false);
|
||||||
}
|
}
|
||||||
} else if (markdownData && news) {
|
} else if (markdownData) {
|
||||||
setNews(matter(newsData));
|
setNews(matter(newsData));
|
||||||
setShowNewsModal(true);
|
setShowNewsModal(true);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user