diff --git a/README.md b/README.md index cc06db9..6338dbb 100644 --- a/README.md +++ b/README.md @@ -95,6 +95,7 @@ There is trivial security on the web pages to allow for multiple user support. - download icon > [Download by Yoyo from the Noun Project](https://thenounproject.com/term/download/2120379/) - share icon > [Share by Тимур Минвалеев from the Noun Project](https://thenounproject.com/term/share/1058858/) - done icon > [done by Viktor Ostrovsky from the Noun Project](https://thenounproject.com/term/done/587164/) +- settings icon > [setting by LUTFI GANI AL ACHMAD from the Noun Project](https://thenounproject.com/term/settings/3291880/) ## server diff --git a/client/components/about.js b/client/components/about.js index 1e2cf17..c6b3fe2 100644 --- a/client/components/about.js +++ b/client/components/about.js @@ -3,18 +3,51 @@ app.addSetter('aboutModal.open', (data) => { }); app.addSetter('aboutModal.close', (data) => { + data.apiKey = null; + data.showApiKey = false; data.aboutModal.active = false; }); +app.addSetter('about.showApiKey', async (data, apiKey) => { + data.apiKey = apiKey; + data.showApiKey = true; +}); + +async function showApiKey(){ + let result = await fetch("/api/apikey"); + let json = await result.json(); + let apiKey = json.apiKey; + store.do('about.showApiKey', encodeURIComponent(apiKey)); +} + app.addComponent('aboutModal', (store) => { return new Reef("#aboutModal", { store: store, template: (data) => { + + let apiKeyElement = ""; + if ( data.showApiKey ){ + apiKeyElement = /*html*/` +
+

api key for ${data.user.name}:

+ +

+
+ `; + } + return /*html*/`