Revived the page! He's baaaaack
This commit is contained in:
15
ui/src/api/units.ts
Normal file
15
ui/src/api/units.ts
Normal file
@@ -0,0 +1,15 @@
|
||||
import { memberSettings, Member, MemberLight, MemberCardDetails } from "@shared/types/member";
|
||||
import { Unit } from "@shared/types/units";
|
||||
|
||||
// @ts-ignore
|
||||
const addr = import.meta.env.VITE_APIHOST;
|
||||
|
||||
export async function getUnits(): Promise<Unit[]> {
|
||||
const response = await fetch(`${addr}/units`, {
|
||||
credentials: 'include'
|
||||
});
|
||||
if (!response.ok) {
|
||||
throw new Error("Failed to fetch units");
|
||||
}
|
||||
return response.json();
|
||||
}
|
||||
Reference in New Issue
Block a user