From ae263730d90cda3b50e7bddf28aa5ade8995e053 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=C3=A9ry=20Debongnie?= Date: Thu, 18 Apr 2019 22:42:37 +0200 Subject: [PATCH] [ADD] utils: add loadTemplates function --- src/utils.ts | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/utils.ts b/src/utils.ts index 89ea0d55..a07064db 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -163,3 +163,13 @@ export function unpatch(C: any, patchName: string) { } } } + +export async function loadTemplates(url: string): Promise { + const result = await fetch(url); + if (!result.ok) { + throw new Error("Error while fetching xml templates"); + } + let templates = await result.text(); + templates = templates.replace(//g, ""); + return templates; +} \ No newline at end of file