mirror of
https://github.com/hubHarmony/servii-frontend.git
synced 2024-11-18 05:40:31 +00:00
sorted history yay
This commit is contained in:
parent
0a0b5a7020
commit
89477505aa
@ -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