Übersetzungen Server und Client
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
import ky from 'ky'
|
||||
import type { Translation } from '../../data/translation'
|
||||
|
||||
export const getTranslations = async (): Promise<Translation[]> => {
|
||||
return ky.get(`http://localhost:8088/translations`).json<Translation[]>()
|
||||
}
|
||||
|
||||
export const getTranslationById = async (id: number): Promise<Translation> => {
|
||||
return ky.get(`http://localhost:8088/translation/${id}`).json<Translation>()
|
||||
}
|
||||
|
||||
export const createTranslation = async (translation: Translation): Promise<Translation> => {
|
||||
return ky.post(`http://localhost:8088/translation`, { json: translation }).json<Translation>()
|
||||
}
|
||||
|
||||
export const updateTranslation = async (translation: Translation): Promise<Translation> => {
|
||||
return ky.put(`http://localhost:8088/translation`, { json: translation }).json<Translation>()
|
||||
}
|
||||
|
||||
export const deleteTranslation = async (id: number): Promise<void> => {
|
||||
return ky.delete(`http://localhost:8088/translation/${id}`).json<void>()
|
||||
}
|
||||
|
||||
export const getTranslationsByLanguageId = async (language_id: number): Promise<Translation[]> => {
|
||||
return ky.get(`http://localhost:8088/translations/${language_id}`).json<Translation[]>()
|
||||
}
|
||||
Reference in New Issue
Block a user