Skip to content

Commit

Permalink
Remove AWS related Dependencies and Config (#77)
Browse files Browse the repository at this point in the history
* chore: remove aws-amplify related dep and config

* chore: upgrade ts build target to 'ES2022'
  • Loading branch information
yccodr authored Mar 7, 2024
1 parent 4782ecc commit 3c7fdc4
Show file tree
Hide file tree
Showing 9 changed files with 341 additions and 5,681 deletions.
3 changes: 0 additions & 3 deletions frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
"version": "0.1.0",
"private": true,
"dependencies": {
"@aws-amplify/ui-react": "~4.3.8",
"@emotion/react": "^11.11.4",
"@emotion/styled": "^11.11.0",
"@mui/icons-material": "^5.15.11",
Expand All @@ -12,8 +11,6 @@
"@types/react": "^18.2.61",
"@types/react-dom": "^18.2.19",
"@vitejs/plugin-react-swc": "^3.6.0",
"amplify-material-ui": "^1.0.2",
"aws-amplify": "~5.0.15",
"axios": "^1.6.7",
"dayjs": "^1.11.10",
"react": "^18.2.0",
Expand Down
20 changes: 0 additions & 20 deletions frontend/src/AppCognito.tsx

This file was deleted.

10 changes: 2 additions & 8 deletions frontend/src/SimpleListMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ import ListItemText from "@mui/material/ListItemText";
import MenuItem from "@mui/material/MenuItem";
import Menu from "@mui/material/Menu";

import { config } from "./constants/config";
import { Auth } from "aws-amplify";
import { LoginContext } from "./LoginContext";

const options = ["Change Password", "Logout"];
Expand All @@ -32,12 +30,8 @@ export default function SimpleListMenu(props: SimpleListMenuProps) {
}

function onLogout() {
if (config.enableCognitoAuth) {
Auth.signOut();
} else {
setUser(null);
navigation("/login");
}
setUser(null);
navigation("/login");
}

const handleMenuItemClick = (event: React.MouseEvent<HTMLElement>, index: number) => {
Expand Down
7 changes: 0 additions & 7 deletions frontend/src/constants/aws.tsx

This file was deleted.

1 change: 0 additions & 1 deletion frontend/src/constants/config.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
export const config = {
enableCognitoAuth: false,
enablePagination: false,
};
4 changes: 1 addition & 3 deletions frontend/src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,11 @@ import React from "react";
import ReactDOM from "react-dom/client";
import "./index.css";
import App from "./App";
import AppCognito from "./AppCognito";
import reportWebVitals from "./reportWebVitals";
import { config } from "./constants/config";

const root = ReactDOM.createRoot(document.getElementById("root") as HTMLElement);
root.render(
<React.StrictMode>{config.enableCognitoAuth ? <AppCognito /> : <App />}</React.StrictMode>,
<React.StrictMode><App /></React.StrictMode>,
);

// If you want to start measuring performance in your app, pass a function
Expand Down
11 changes: 2 additions & 9 deletions frontend/src/pages/Logout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,22 +5,15 @@ import ListItemIcon from "@mui/material/ListItemIcon";
import ListItemText from "@mui/material/ListItemText";
import PhoneAndroid from "@mui/icons-material/PhoneAndroid";

import { config } from "../constants/config";
import { Auth } from "aws-amplify";

import { LoginContext } from "../LoginContext";

export const Logout = () => {
const navigation = useNavigate();
const { setUser } = useContext(LoginContext);

function onLogout() {
if (config.enableCognitoAuth) {
Auth.signOut();
} else {
setUser(null);
navigation("/login");
}
setUser(null);
navigation("/login");
}

return (
Expand Down
2 changes: 1 addition & 1 deletion frontend/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"compilerOptions": {
"target": "es5",
"target": "ES2022",
"lib": [
"dom",
"dom.iterable",
Expand Down
Loading

0 comments on commit 3c7fdc4

Please sign in to comment.