From 06ad93aa09e68f787fef53089a2768d2c1d19fa4 Mon Sep 17 00:00:00 2001 From: soupette Date: Thu, 6 May 2021 09:17:26 +0200 Subject: [PATCH] Fix PR feedback Signed-off-by: soupette --- .../admin/admin/src/containers/Admin/index.js | 54 +++++++++---------- 1 file changed, 26 insertions(+), 28 deletions(-) diff --git a/packages/core/admin/admin/src/containers/Admin/index.js b/packages/core/admin/admin/src/containers/Admin/index.js index bf24a63f52..6e56121087 100644 --- a/packages/core/admin/admin/src/containers/Admin/index.js +++ b/packages/core/admin/admin/src/containers/Admin/index.js @@ -120,40 +120,38 @@ export class Admin extends React.Component { getStrapiLatestReleaseSucceeded, } = this.props; - if (!STRAPI_ADMIN_UPDATE_NOTIFICATION === 'true') { - return; - } + if (STRAPI_ADMIN_UPDATE_NOTIFICATION === 'true') { + try { + const { + data: { tag_name }, + } = await axios.get('https://api.github.com/repos/strapi/strapi/releases/latest'); + const shouldUpdateStrapi = checkLatestStrapiVersion(strapiVersion, tag_name); - try { - const { - data: { tag_name }, - } = await axios.get('https://api.github.com/repos/strapi/strapi/releases/latest'); - const shouldUpdateStrapi = checkLatestStrapiVersion(strapiVersion, tag_name); + getStrapiLatestReleaseSucceeded(tag_name, shouldUpdateStrapi); - getStrapiLatestReleaseSucceeded(tag_name, shouldUpdateStrapi); + const showUpdateNotif = !JSON.parse(localStorage.getItem('STRAPI_UPDATE_NOTIF')); - const showUpdateNotif = !JSON.parse(localStorage.getItem('STRAPI_UPDATE_NOTIF')); + if (!showUpdateNotif) { + return; + } - if (!showUpdateNotif) { - return; - } - - if (shouldUpdateStrapi) { - strapi.notification.toggle({ - type: 'info', - message: { id: 'notification.version.update.message' }, - link: { - url: `https://github.com/strapi/strapi/releases/tag/${tag_name}`, - label: { - id: 'notification.version.update.link', + if (shouldUpdateStrapi) { + strapi.notification.toggle({ + type: 'info', + message: { id: 'notification.version.update.message' }, + link: { + url: `https://github.com/strapi/strapi/releases/tag/${tag_name}`, + label: { + id: 'notification.version.update.link', + }, }, - }, - blockTransition: true, - onClose: () => localStorage.setItem('STRAPI_UPDATE_NOTIF', true), - }); + blockTransition: true, + onClose: () => localStorage.setItem('STRAPI_UPDATE_NOTIF', true), + }); + } + } catch (err) { + // Silent } - } catch (err) { - // Silent } };