mirror of
https://github.com/hubHarmony/servii-frontend.git
synced 2024-11-17 21:40:30 +00:00
Merge pull request #39 from hubHarmony/SortedHistory
sorted history yay
This commit is contained in:
commit
4ec70e510e
@ -53,8 +53,13 @@ const ServerHistory = () => {
|
||||
return parsedEntry;
|
||||
});
|
||||
|
||||
const sortedHistoryArray = historyArray.sort((a, b) => {
|
||||
const dateA = new Date(a.timestamp);
|
||||
const dateB = new Date(b.timestamp);
|
||||
return dateB - dateA;
|
||||
});
|
||||
|
||||
setHistory(historyArray);
|
||||
setHistory(sortedHistoryArray);
|
||||
} else {
|
||||
console.error("Failed to fetch history, response:", response);
|
||||
}
|
||||
@ -66,6 +71,7 @@ const ServerHistory = () => {
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
useEffect(() => {
|
||||
fetchServerHistory();
|
||||
}, [serverName]);
|
||||
|
Loading…
Reference in New Issue
Block a user