material editor update
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
import ky from 'ky'
|
||||
import type { Language } from '../../data/language'
|
||||
|
||||
export const getLanguages = async (): Promise<Language[]> => {
|
||||
return ky.get(`http://localhost:8088/languages`).json<Language[]>()
|
||||
}
|
||||
|
||||
export const getLanguageById = async (id: number): Promise<Language> => {
|
||||
return ky.get(`http://localhost:8088/language/${id}`).json<Language>()
|
||||
}
|
||||
|
||||
export const createLanguage = async (language: Language): Promise<Language> => {
|
||||
return ky.post(`http://localhost:8088/language`, { json: language }).json<Language>()
|
||||
}
|
||||
|
||||
export const updateLanguage = async (language: Language): Promise<Language> => {
|
||||
return ky.put(`http://localhost:8088/language`, { json: language }).json<Language>()
|
||||
}
|
||||
|
||||
export const deleteLanguage = async (id: number): Promise<void> => {
|
||||
return ky.delete(`http://localhost:8088/language/${id}`).json<void>()
|
||||
}
|
||||
Reference in New Issue
Block a user