Don't make two API calls for activity log data

This commit is contained in:
DaneEveritt 2022-06-11 14:52:33 -04:00
parent 986c375052
commit 06427f8d13
No known key found for this signature in database
GPG key ID: EEA66103B3D71F53
4 changed files with 35 additions and 2 deletions

View file

@ -65,3 +65,13 @@ export function hashToPath (hash: string): string {
export function formatIp (ip: string): string {
return /([a-f0-9:]+:+)+[a-f0-9]+/.test(ip) ? `[${ip}]` : ip;
}
// eslint-disable-next-line @typescript-eslint/ban-types
export const isObject = (o: unknown): o is {} => typeof o === 'object' && o !== null;
// eslint-disable-next-line @typescript-eslint/ban-types
export const isEmptyObject = (o: {}): boolean =>
Object.keys(o).length === 0 && Object.getPrototypeOf(o) === Object.prototype;
// eslint-disable-next-line @typescript-eslint/ban-types
export const getObjectKeys = <T extends {}> (o: T): Array<keyof T> => Object.keys(o) as Array<keyof T>;