From 59c5dead517f4942b73f9a038486bd5c4d315b1c Mon Sep 17 00:00:00 2001 From: Pavel Denisjuk Date: Tue, 26 Oct 2021 13:46:29 +0200 Subject: [PATCH] fix: remove obsolete files --- apps/admin/code/src/App.tsx | 71 ++++++++++--------- .../common/apps/admin/code/src/App.tsx | 2 - .../code/src/components/getIdentityData.ts | 19 ----- 3 files changed, 36 insertions(+), 56 deletions(-) delete mode 100644 packages/cwp-template-aws/template/common/apps/admin/code/src/components/getIdentityData.ts diff --git a/apps/admin/code/src/App.tsx b/apps/admin/code/src/App.tsx index 1b95424aa6b..92e6a919bce 100644 --- a/apps/admin/code/src/App.tsx +++ b/apps/admin/code/src/App.tsx @@ -4,48 +4,49 @@ import { UiProvider } from "@webiny/app/contexts/Ui"; import { Routes } from "@webiny/app/components/Routes"; import { I18NProvider } from "@webiny/app-i18n/contexts/I18N"; import { SecurityProvider } from "@webiny/app-security"; +import { TenancyProvider } from "@webiny/app-tenancy/contexts/Tenancy"; import { CircularProgress } from "@webiny/ui/Progress"; import { AppInstaller } from "@webiny/app-admin/components/AppInstaller"; import { CmsProvider } from "@webiny/app-headless-cms/admin/contexts/Cms"; import { PageBuilderProvider } from "@webiny/app-page-builder/contexts/PageBuilder"; import { BrowserRouter } from "@webiny/react-router"; -import { TenancyProvider } from "@webiny/app-tenancy"; import { createAuthentication } from "@webiny/app-admin-users-cognito"; import { createApolloClient } from "./components/apolloClient"; import { Telemetry } from "./components/Telemetry"; import "./App.scss"; -const Authentication = createAuthentication(); - export const App = () => ( - - - {/* - is a generic provider of identity information. 3rd party identity providers (like Cognito, - Okta, Auth0) will handle the authentication, and set the information about the user into this provider, - so other parts of the system have a centralized place to fetch user information from. + + {/* + provides tenant context and a mechanism to switch tenants in a multi-tenant environment. */} + + {/* + is a generic provider of identity information. 3rd party identity providers (like Cognito, + Okta, Auth0) will handle the authentication, and set the information about the user into this provider, + so other parts of the system have a centralized place to fetch user information from. + */} {/* - is an enhanced version of "react-router" to add some capabilities specific to Webiny. - */} + is an enhanced version of "react-router" to add some capabilities specific to Webiny. + */} {/* - To learn more about Webiny telemetry system, please visit: https://docs.webiny.com/docs/webiny-telemetry - */} + To learn more about Webiny telemetry system, please visit: https://docs.webiny.com/docs/webiny-telemetry + */} {/* - is a centralized state handler for UI related things. When you need to render - dialogs, snackbars, handle dark mode, you can use the "useUi()" hook to set/unset UI information - without losing the state on route transitions. - NOTE: we do not recommend using this provider for you application data, it's just a helper state - manager to handle UI easier. - */} + is a centralized state handler for UI related things. When you need to render + dialogs, snackbars, handle dark mode, you can use the "useUi()" hook to set/unset UI information + without losing the state on route transitions. + NOTE: we do not recommend using this provider for you application data, it's just a helper state + manager to handle UI easier. + */} {/* - checks and runs app installers registered via "admin-installation" plugins. - */} - + checks and runs app installers registered via "admin-installation" plugins. + */} + {/* loads system locales. Webiny supports multi-language content and language-based permissions, so we always need to know all locales to be able to render language selectors, @@ -55,21 +56,21 @@ export const App = () => ( loader={} > {/* - handles "pb-theme" plugins and combines them into a single - "theme" object. You can build your theme using multiple "pb-theme" plugins and - then access is using "usePageBuilder()" hook. - */} + handles "pb-theme" plugins and combines them into a single + "theme" object. You can build your theme using multiple "pb-theme" plugins and + then access is using "usePageBuilder()" hook. + */} {/* - handles CMS environments and provides an Apollo Client instance - that points to the /manage GraphQL API. - */} + handles CMS environments and provides an Apollo Client instance + that points to the /manage GraphQL API. + */} {/* - is a helper component that loads all "route" plugins, sorts them - in the correct "path" order and renders using the component, - so only the matching route is rendered. - */} + is a helper component that loads all "route" plugins, sorts them + in the correct "path" order and renders using the component, + so only the matching route is rendered. + */} @@ -78,6 +79,6 @@ export const App = () => ( - - + + ); diff --git a/packages/cwp-template-aws/template/common/apps/admin/code/src/App.tsx b/packages/cwp-template-aws/template/common/apps/admin/code/src/App.tsx index 1fed4fd2624..92e6a919bce 100644 --- a/packages/cwp-template-aws/template/common/apps/admin/code/src/App.tsx +++ b/packages/cwp-template-aws/template/common/apps/admin/code/src/App.tsx @@ -13,8 +13,6 @@ import { BrowserRouter } from "@webiny/react-router"; import { createAuthentication } from "@webiny/app-admin-users-cognito"; import { createApolloClient } from "./components/apolloClient"; import { Telemetry } from "./components/Telemetry"; - -// Import styles which include custom theme styles import "./App.scss"; export const App = () => ( diff --git a/packages/cwp-template-aws/template/common/apps/admin/code/src/components/getIdentityData.ts b/packages/cwp-template-aws/template/common/apps/admin/code/src/components/getIdentityData.ts deleted file mode 100644 index 136a04ebb14..00000000000 --- a/packages/cwp-template-aws/template/common/apps/admin/code/src/components/getIdentityData.ts +++ /dev/null @@ -1,19 +0,0 @@ -import { LOGIN } from "@webiny/app-security-admin-users/graphql"; - -/** - * `getIdentityData` is a function that has to return information about the identity (a user within Webiny). - * ======================================================================================== - * This function will be executed after Cognito (or any other identity provider you may use) validates the credentials - * and obtains a valid JWT. Since JWT doesn't contain all the necessary information about a user, we need to perform the - * "login" mutation, which doesn't really do anything except fetches the user's information our app needs (like permissions, avatar, etc.) - * - * Using this "login" mutation you can return custom data relevant to the business logic of your app. - * The `payload` argument contains the whole JWT token so you can conditionally perform different mutations depending on - * the information contained within the JWT. - */ - -/* eslint-disable-next-line @typescript-eslint/no-unused-vars */ -export const getIdentityData = async ({ client, payload }) => { - const { data } = await client.mutate({ mutation: LOGIN }); - return data.security.login.data; -};