git.schokokeks.org
Repositories
Help
Report an Issue
fs-words.git
Code
Commits
Branches
Tags
Suche
Strukturansicht:
409a0a2
Branches
Tags
develop-client_server
master
typescript
fs-words.git
client
source
services
service.ts
[mod] client
Christian Fraß
commited
409a0a2
at 2021-03-12 22:01:10
service.ts
Blame
History
Raw
namespace folksprak.words.services { /** */ export function _abstract ( action_name : string, input : any ) : Promise<any> { return ( fetch ( lib_url.encode ( { "protocol": "http", "host": folksprak.words.conf.get("server.host"), "port": folksprak.words.conf.get("server.port"), "path": folksprak.words.conf.get("server.path"), } ), { "method": "POST", "headers": { "Content-Type": "application/json", }, "body": lib_json.encode ( { "action": action_name, "input": input, } ), } ) .then(x => x.json()) ); } /** */ export type type_translate = Array< { language_from : string; value_from : string; language_to : string; value_to : string; } >; export async function translate ( language_from : string, language_to : string, token : string ) : Promise<type_translate> { const result : any = await _abstract ( 'translate', { 'language_from': language_from, 'language_to': language_to, 'token': token, } ); return Promise.resolve<type_translate>(<type_translate>(result)); } }