Feat configui support cognito (#4875)
* revert(dockercompose): revert docker compose file
* fix for build
diff --git a/config-ui/index.html b/config-ui/index.html
index e868c60..06ac226 100644
--- a/config-ui/index.html
+++ b/config-ui/index.html
@@ -16,10 +16,10 @@
-->
<!--
-____ _______ __ _ _ _ _______
+____ _______ __ _ _ _ _______
| _ \| ____\ \ / / | | / \ | |/ / ____|
-| | | | _| \ \ / / | | / _ \ | ' /| _|
-| |_| | |___ \ V / | |___ / ___ \| . \| |___
+| | | | _| \ \ / / | | / _ \ | ' /| _|
+| |_| | |___ \ V / | |___ / ___ \| . \| |___
|____/|_____| \_/ |_____/_/ \_\_|\_\_____|
@@ -44,6 +44,12 @@
</head>
<body>
<div id="root"></div>
+ <script>
+ if (typeof window.global === 'undefined') {
+ window.global = window;
+ }
+ </script>
+ }
<script type="module" src="/src/main.tsx"></script>
</body>
</html>
diff --git a/config-ui/src/App.tsx b/config-ui/src/App.tsx
index 2f6b167..8a50bff 100644
--- a/config-ui/src/App.tsx
+++ b/config-ui/src/App.tsx
@@ -36,14 +36,15 @@
import '@aws-amplify/ui-react/styles.css';
import { Auth } from '@aws-amplify/auth';
import { awsExports } from './aws-exports';
+import { WithAuthenticatorProps } from '@aws-amplify/ui-react/dist/types/components/Authenticator/withAuthenticator';
Amplify.configure(awsExports);
-function App({ signOut, user }) {
+function App({ signOut, user }: WithAuthenticatorProps) {
Auth.currentSession().then((data) => console.log('test', data.getIdToken()));
return (
<BaseLayout>
- <h1>Hello {user.username}</h1>
+ <h1>Hello {user?.username}</h1>
<button onClick={signOut}>Sign out</button>
<Switch>
<Route path="/" exact component={() => <Redirect to="/projects" />} />
diff --git a/config-ui/src/utils/request.ts b/config-ui/src/utils/request.ts
index 3763337..b664f07 100644
--- a/config-ui/src/utils/request.ts
+++ b/config-ui/src/utils/request.ts
@@ -54,6 +54,7 @@
params.data = data;
}
+ // Return the request result to the outer Promise
instance.request(params).then((resp) => resolve(resp.data));
if (signal) {
@@ -61,7 +62,8 @@
cancelTokenSource?.cancel();
});
}
- });
+ }); // If Auth.currentSession fails, pass the error to the outer Promise
});
- return requestPromise;
+
+ return requestPromise as Promise<any>;
};
diff --git a/config-ui/vite.config.ts b/config-ui/vite.config.ts
index c8c3923..e074b57 100644
--- a/config-ui/vite.config.ts
+++ b/config-ui/vite.config.ts
@@ -34,12 +34,13 @@
},
},
- define: {
- global: {},
- },
resolve: {
alias: {
'@': path.join(__dirname, './src'),
+ './runtimeConfig': './runtimeConfig.browser',
},
},
+ optimizeDeps: {
+ exclude: ['@juggle/resize-observer'],
+ },
});