18 lines
438 B
TypeScript
18 lines
438 B
TypeScript
import { clsx, type ClassValue } from "clsx"
|
|
import { twMerge } from "tailwind-merge"
|
|
|
|
export function cn(...inputs: ClassValue[]) {
|
|
return twMerge(clsx(inputs))
|
|
}
|
|
|
|
|
|
export async function httpApi<T>(route: string): Promise<T> {
|
|
let response = await fetch(import.meta.env.VITE_APP_URL + "/api" + route);
|
|
|
|
if (!response.ok) {
|
|
throw new Error(`HTTP error! status: ${response.status}`);
|
|
}
|
|
|
|
return response.json();
|
|
}
|