From 6cd9a5ff3f06d86924364fcd2e277fdd0c4de0c8 Mon Sep 17 00:00:00 2001 From: yann300 Date: Wed, 2 Dec 2020 11:37:56 +0100 Subject: [PATCH] load list of plugins and save to localstorage for online usage --- apps/remix-ide/src/remixAppManager.js | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/apps/remix-ide/src/remixAppManager.js b/apps/remix-ide/src/remixAppManager.js index f85a7b4f8e..7e5cff90b8 100644 --- a/apps/remix-ide/src/remixAppManager.js +++ b/apps/remix-ide/src/remixAppManager.js @@ -87,8 +87,22 @@ export class RemixAppManager extends PluginManager { } async registeredPlugins () { - const res = await fetch(this.pluginsDirectory) - const plugins = await res.json() + let plugins + try { + const res = await fetch(this.pluginsDirectory) + plugins = await res.json() + localStorage.setItem('plugins-directory', JSON.stringify(plugins)) + } catch (e) { + console.log('getting plugins list from localstorage...') + const savedPlugins = localStorage.getItem('plugins-directory') + if (savedPlugins) { + try { + plugin = JSON.parse(savedPlugins) + } catch (e) { + console.error(e) + } + } + } plugins.push({ name: 'walletconnect', kind: 'provider',