mirror of
https://github.com/hubHarmony/servii-frontend.git
synced 2024-11-18 05:40:31 +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;
|
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 {
|
} else {
|
||||||
console.error("Failed to fetch history, response:", response);
|
console.error("Failed to fetch history, response:", response);
|
||||||
}
|
}
|
||||||
@ -66,6 +71,7 @@ const ServerHistory = () => {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
fetchServerHistory();
|
fetchServerHistory();
|
||||||
}, [serverName]);
|
}, [serverName]);
|
||||||
|
Loading…
Reference in New Issue
Block a user