import ky from 'ky' import type { Language } from '../../data/language' export const getLanguages = async (): Promise => { return ky.get(`http://localhost:8088/languages`).json() } export const getLanguageById = async (id: number): Promise => { return ky.get(`http://localhost:8088/language/${id}`).json() } export const createLanguage = async (language: Language): Promise => { return ky.post(`http://localhost:8088/language`, { json: language }).json() } export const updateLanguage = async (language: Language): Promise => { return ky.put(`http://localhost:8088/language`, { json: language }).json() } export const deleteLanguage = async (id: number): Promise => { return ky.delete(`http://localhost:8088/language/${id}`).json() }