From 39843c2325deee5365e5917697f9698202cbd00f Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Tue, 13 Feb 2024 15:11:59 +0100 Subject: [PATCH] Bug 36084: Add a Dialog class To display potential errors. Signed-off-by: Jonathan Druart --- .../intranet-tmpl/prog/js/fetch/http-client.js | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/js/fetch/http-client.js b/koha-tmpl/intranet-tmpl/prog/js/fetch/http-client.js index 1da2b563ca..83c8d078b9 100644 --- a/koha-tmpl/intranet-tmpl/prog/js/fetch/http-client.js +++ b/koha-tmpl/intranet-tmpl/prog/js/fetch/http-client.js @@ -1,4 +1,18 @@ -//import { setError, submitting, submitted } from "../messages"; +class Dialog { + constructor(options = {}) {} + + setMessage(message) { + $("#messages").append( + '
%s
'.format(message) + ); + } + + setError(error) { + $("#messages").append( + '
%s
'.format(error) + ); + } +} class HttpClient { constructor(options = {}) { @@ -45,7 +59,7 @@ class HttpClient { }) .catch(err => { error = err; - //setError(err); + new Dialog().setError(err); console.error(err); }) .then(() => { -- 2.39.5