mirror of
https://codeberg.org/likwid/likwid.git
synced 2026-06-25 15:37:42 +00:00
38 lines
791 B
TypeScript
38 lines
791 B
TypeScript
|
|
export const API_BASE = 'http://localhost:3000';
|
||
|
|
|
||
|
|
export interface HealthResponse {
|
||
|
|
status: string;
|
||
|
|
version: string;
|
||
|
|
}
|
||
|
|
|
||
|
|
export interface Community {
|
||
|
|
id: string;
|
||
|
|
name: string;
|
||
|
|
slug: string;
|
||
|
|
description: string | null;
|
||
|
|
created_at: string;
|
||
|
|
}
|
||
|
|
|
||
|
|
export interface User {
|
||
|
|
id: string;
|
||
|
|
username: string;
|
||
|
|
email: string;
|
||
|
|
display_name: string | null;
|
||
|
|
created_at: string;
|
||
|
|
}
|
||
|
|
|
||
|
|
export async function getHealth(): Promise<HealthResponse> {
|
||
|
|
const res = await fetch(`${API_BASE}/health`);
|
||
|
|
return res.json();
|
||
|
|
}
|
||
|
|
|
||
|
|
export async function getCommunities(): Promise<Community[]> {
|
||
|
|
const res = await fetch(`${API_BASE}/api/communities`);
|
||
|
|
return res.json();
|
||
|
|
}
|
||
|
|
|
||
|
|
export async function getUsers(): Promise<User[]> {
|
||
|
|
const res = await fetch(`${API_BASE}/api/users`);
|
||
|
|
return res.json();
|
||
|
|
}
|