Some checks failed
Push image to registry / build-image (push) Failing after 3m47s
26 lines
687 B
TypeScript
26 lines
687 B
TypeScript
import type { Updater } from '@tanstack/vue-table'
|
|
import type { Ref } from 'vue'
|
|
import { type ClassValue, clsx } from 'clsx'
|
|
import { twMerge } from 'tailwind-merge'
|
|
|
|
export function cn(...inputs: ClassValue[]) {
|
|
return twMerge(clsx(inputs))
|
|
}
|
|
|
|
export function valueUpdater<T extends Updater<any>>(updaterOrValue: T, ref: Ref) {
|
|
ref.value
|
|
= typeof updaterOrValue === 'function'
|
|
? updaterOrValue(ref.value)
|
|
: updaterOrValue
|
|
}
|
|
|
|
export async function httpApi<T>(route: string): Promise<T> {
|
|
let response = await fetch("/api" + route);
|
|
|
|
if (!response.ok) {
|
|
throw new Error(`HTTP error! status: ${response.status}`);
|
|
}
|
|
|
|
return response.json();
|
|
}
|