cleanup and track friends data (if not being already tracked)
This commit is contained in:
projects
@ -1,4 +1,6 @@
|
||||
import { PlayerHistory } from "../types/player/player-history";
|
||||
import { kyFetch } from "./utils";
|
||||
import { Config } from "../config";
|
||||
|
||||
/**
|
||||
* Sorts the player history based on date,
|
||||
@ -11,3 +13,12 @@ export function sortPlayerHistory(history: Map<string, PlayerHistory>) {
|
||||
(a, b) => Date.parse(b[0]) - Date.parse(a[0]) // Sort in descending order
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Ensure the player is being tracked.
|
||||
*
|
||||
* @param id the player id
|
||||
*/
|
||||
export async function trackPlayer(id: string) {
|
||||
await kyFetch(`${Config.apiUrl}/player/history/${id}?createIfMissing=true`);
|
||||
}
|
||||
|
Reference in New Issue
Block a user