mirror of
https://github.com/pterodactyl/panel.git
synced 2026-11-30 11:25:52 -05:00
Co-authored-by: Anthony <anthony@infraly.co> Co-authored-by: Sky Mulley <daniel.mulley@outlook.com>
14 lines
490 B
TypeScript
14 lines
490 B
TypeScript
// Fractal returns a NullResource for any include the viewer lacks permission for.
|
|
|
|
interface NullResourceLike {
|
|
object: 'null_resource';
|
|
}
|
|
|
|
export function relationshipData<T>(relationship: { data: T[] } | NullResourceLike | undefined): T[] {
|
|
return relationship && 'data' in relationship ? relationship.data : [];
|
|
}
|
|
|
|
export function relationshipAttributes<A>(relationship: { attributes: A | null } | undefined): A | undefined {
|
|
return relationship?.attributes ?? undefined;
|
|
}
|