fix: continue conversion of settings system

This commit is contained in:
David Ralph
2024-06-14 19:51:43 +01:00
parent a7ba47d15b
commit 0e383ccc0d
6 changed files with 30 additions and 52 deletions

View File

@@ -46,15 +46,6 @@ const Overview = () => {
'message',
],
);
const [news, setNews] = useState({
title: '',
date: '',
description: '',
link: '',
linkText: '',
});
const [newsDone, setNewsDone] = useState(false);
const [loading, setLoading] = useState(true);
const arrayMove = (array, oldIndex, newIndex) => {
const result = Array.from(array);
@@ -102,30 +93,6 @@ const Overview = () => {
}
};
const getNews = useCallback(async () => {
try {
const response = await fetch(`${variables.constants.API_URL}/news`);
const data = await response.json();
data.date = new window.Date(data.date).toLocaleDateString(
variables.languagecode.replace('_', '-'),
{
year: 'numeric',
month: 'long',
day: 'numeric',
},
);
setNews(data);
setNewsDone(true);
} catch (error) {
console.error('Failed to fetch news:', error);
} finally {
setLoading(false);
}
}, []);
useEffect(() => {
getNews();
}, [getNews]);
useEffect(() => {
localStorage.setItem('order', JSON.stringify(items));