From 28fb38bf0cc442b4d35889db0f22a25b316196e3 Mon Sep 17 00:00:00 2001 From: Pierre HUBERT Date: Wed, 17 Feb 2021 18:38:04 +0100 Subject: [PATCH] Move function to a more logical location --- assets/js/components/account/interface.js | 8 ++++++++ assets/js/components/settings/interface.js | 10 +--------- assets/js/pages/settings/sections/password.js | 2 +- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/assets/js/components/account/interface.js b/assets/js/components/account/interface.js index 5483454c..65f72f36 100644 --- a/assets/js/components/account/interface.js +++ b/assets/js/components/account/interface.js @@ -45,6 +45,14 @@ const AccountInterface = { ComunicWeb.common.api.makeAPIrequest(apiURI, params, true, callback); }, + /** + * Get current user email address + */ + getMail: async function() { + const res = await api("account/mail", null, true); + return res.mail; + }, + /** * Check whether the security questions have been set for an account * with an email address or not diff --git a/assets/js/components/settings/interface.js b/assets/js/components/settings/interface.js index f0b8cd40..974bf2de 100644 --- a/assets/js/components/settings/interface.js +++ b/assets/js/components/settings/interface.js @@ -30,15 +30,7 @@ const SettingsInterface = { var apiURI = "settings/set_general"; ComunicWeb.common.api.makeAPIrequest(apiURI, settings, true, callback); }, - - /** - * Get current user email address - */ - getMail: async function() { - const res = await api("account/mail", null, true); - return res.mail; - }, - + /** * Check the availability of the virtual directory for user * diff --git a/assets/js/pages/settings/sections/password.js b/assets/js/pages/settings/sections/password.js index 60128abd..ff6a9752 100644 --- a/assets/js/pages/settings/sections/password.js +++ b/assets/js/pages/settings/sections/password.js @@ -66,7 +66,7 @@ ComunicWeb.pages.settings.sections.password = { let user = await userInfo(userID()); newPasswordInput.setUser(user) - let mail = await SettingsInterface.getMail() + let mail = await AccountInterface.getMail() newPasswordInput.setEmail(mail) } catch(e) { console.error(e);