From 89280ec35a0cdae77a4d593f7da14496e2821324 Mon Sep 17 00:00:00 2001 From: hache Date: Thu, 9 Nov 2023 17:30:10 -0500 Subject: [PATCH 1/6] Add types to App component --- src/App.jsx | 154 --------------------- src/App.tsx | 303 ++++++++++++++++++++++++++++++++++++++++++ src/app/Uim.tsx | 9 +- src/app/uim/Login.tsx | 7 +- 4 files changed, 315 insertions(+), 158 deletions(-) delete mode 100644 src/App.jsx create mode 100644 src/App.tsx diff --git a/src/App.jsx b/src/App.jsx deleted file mode 100644 index a7ae8f79e..000000000 --- a/src/App.jsx +++ /dev/null @@ -1,154 +0,0 @@ -import React from 'react'; -import { Switch, Route, Redirect } from 'react-router-dom'; - -import AppContext from 'app/AppContext'; -import Layout from 'app/Layout'; -import Uim from 'app/Uim'; -import Compensation from 'pages/Compensation'; -import Home from 'pages/Home'; -import Search from 'pages/Search'; -import CBMDashboard from 'pages/CBMDashboard'; -import Indicator from 'pages/Indicator'; -import Portfolio from 'pages/Portfolio'; - -import 'main.css'; -import 'cbm-dashboard/dist/bundle.css'; -import 'indicators/dist/bundle.css'; - -import isFlagEnabled from 'utils/isFlagEnabled'; - -class App extends React.Component { - constructor(props) { - super(props); - this.state = { - user: null, - headerNames: {}, - showCBMDashboard: false - }; - } - - componentDidMount() { - isFlagEnabled('CBMModule') - .then((value) => this.setState({ showCBMDashboard: value })) - } - - buildQuery = (queryString) => new URLSearchParams(queryString); - - - setUser = (user) => this.setState({ user }); - - setHeaderNames = (parent, child) => { - this.setState({ - headerNames: { parent, child }, - }); - } - - loadHome = ({ location }) => ( - this.loadComponent({ - logoSet: 'default', - name:'', - component: (), - }) - ); - - loadSearch = ({ location }) => { - const query = this.buildQuery(location.search); - return this.loadComponent({ - logoSet: null, - name: 'Consultas geográficas', - component: (), - className: 'fullgrid', - }); - } - - loadIndicator = () => ( - this.loadComponent({ - logoSet: null, - name: 'Indicadores', - component: (), - className: 'fullgrid', - }) - ); - - loadCompensator = ({ location }) => { - const { user } = this.state; - if (user) { - return this.loadComponent({ - logoSet: null, - name: 'Compensación ambiental', - component: (), - className: 'fullgrid', - }); - } - return ( - - ); - } - - loadPortfolio = () => ( - this.loadComponent({ - logoSet: null, - name: 'Portafolios', - component: (), - className: 'fullgrid', - }) - ); - - loadCBMDashboard = () => ( - this.loadComponent({ - logoSet: 'monitoreo', - name: 'Monitoreo comunitario', - component: (), - className: 'fullgrid', - }) - ); - - loadComponent = ({ - logoSet, name, component, className = '', - }) => { - const { headerNames } = this.state; - return ( - } - className={className} - > - {component} - - ); - } - - render() { - const { user, showCBMDashboard } = this.state; - return ( - -
- - - - - - - - - -
-
- ); - } -} - -export default App; diff --git a/src/App.tsx b/src/App.tsx new file mode 100644 index 000000000..712dadfcd --- /dev/null +++ b/src/App.tsx @@ -0,0 +1,303 @@ +import React, {useState, useEffect, ReactNode} from 'react'; +import { Switch, Route, Redirect } from 'react-router-dom'; + +import AppContext from 'app/AppContext'; +import Layout from 'app/Layout'; +import Uim from 'app/Uim'; +import Compensation from 'pages/Compensation'; +import Home from 'pages/Home'; +import Search from 'pages/Search'; +import CBMDashboard from 'pages/CBMDashboard'; +import Indicator from 'pages/Indicator'; +import Portfolio from 'pages/Portfolio'; + +import 'main.css'; +import 'cbm-dashboard/dist/bundle.css'; +import 'indicators/dist/bundle.css'; + +import isFlagEnabled from 'utils/isFlagEnabled'; + +import { LogosConfig } from "types/layoutTypes"; +import * as H from 'history'; + + // {hash: "" + // key: "wk98il" + // pathname: "/" + // search: "" + // state: undefined} + +interface LocationTypes { + hash: string; + key: string; + pathname: string; + search: string; + state: undefined; + referrer?: string; +} + +interface LoadComponentTypes { + logoSet: keyof LogosConfig | null; + name: string; + component: ReactNode; + className: string; +} + +const App = (props:any) => { + const [user, setUser] = useState(null); + const [headerNames,setHeaderNames] = useState({}); + const [showCBMDashboard, setShowCBMDashboard] = useState(false); +console.log(props); + useEffect(() => { + isFlagEnabled('CBMModule') + .then((value) => setShowCBMDashboard( value )) + }, []) + + const buildQuery = (queryString: string) => new URLSearchParams(queryString); + + const setMyUser = () => setUser( user ); + + const setMyHeaderNames = (parent: string, child: string) => { + setHeaderNames({ + headerNames: { parent, child }, + }); + } + + const loadHome = ({location}:any) => ( + loadComponent({ + logoSet: 'default', + name:'', + component: (), + className: 'fullgrid', + }) + ); + + const loadSearch = ({location}:any) => { + const query = buildQuery(location.search); + return loadComponent({ + logoSet: null, + name: 'Consultas geográficas', + component: (), + className: 'fullgrid', + }); + } + + const loadIndicator = () => ( + loadComponent({ + logoSet: null, + name: 'Indicadores', + component: (), + className: 'fullgrid', + }) + ); + + const loadCompensator = ({location}:any) => { + if (user) { + return loadComponent({ + logoSet: null, + name: 'Compensación ambiental', + component: (), + className: 'fullgrid', + }); + } + return ( + + ); + } + + const loadPortfolio = () => ( + loadComponent({ + logoSet: null, + name: 'Portafolios', + component: (), + className: 'fullgrid', + }) + ); + + const loadCBMDashboard = () => ( + loadComponent({ + logoSet: 'monitoreo', + name: 'Monitoreo comunitario', + component: (), + className: 'fullgrid', + }) + ); + + const loadComponent = ({ + logoSet, name, component, className = '', + }: LoadComponentTypes) => { + return ( + } + className={className} + > + {component} + + ); + } + + return ( + +
+ + + + + + + + + +
+
+ ); +} + +// class App2 extends React.Component { +// constructor(props) { +// super(props); +// this.state = { +// user: null, +// headerNames: {}, +// showCBMDashboard: false +// }; +// } + +// componentDidMount() { +// isFlagEnabled('CBMModule') +// .then((value) => this.setState({ showCBMDashboard: value })) +// } + +// buildQuery = (queryString) => new URLSearchParams(queryString); + + +// setUser = (user) => this.setState({ user }); + +// setHeaderNames = (parent, child) => { +// this.setState({ +// headerNames: { parent, child }, +// }); +// } + +// loadHome = ({ location }) => ( +// this.loadComponent({ +// logoSet: 'default', +// name:'', +// component: (), +// }) +// ); + +// loadSearch = ({ location }) => { +// const query = this.buildQuery(location.search); +// return this.loadComponent({ +// logoSet: null, +// name: 'Consultas geográficas', +// component: (), +// className: 'fullgrid', +// }); +// } + +// loadIndicator = () => ( +// this.loadComponent({ +// logoSet: null, +// name: 'Indicadores', +// component: (), +// className: 'fullgrid', +// }) +// ); + +// loadCompensator = ({ location }) => { +// const { user } = this.state; +// if (user) { +// return this.loadComponent({ +// logoSet: null, +// name: 'Compensación ambiental', +// component: (), +// className: 'fullgrid', +// }); +// } +// return ( +// +// ); +// } + +// loadPortfolio = () => ( +// this.loadComponent({ +// logoSet: null, +// name: 'Portafolios', +// component: (), +// className: 'fullgrid', +// }) +// ); + +// loadCBMDashboard = () => ( +// this.loadComponent({ +// logoSet: 'monitoreo', +// name: 'Monitoreo comunitario', +// component: (), +// className: 'fullgrid', +// }) +// ); + +// loadComponent = ({ +// logoSet, name, component, className = '', +// }) => { +// const { headerNames } = this.state; +// return ( +// } +// className={className} +// > +// {component} +// +// ); +// } + +// render() { +// const { user, showCBMDashboard } = this.state; +// return ( +// +//
+// +// +// +// +// +// +// +// +// +//
+//
+// ); +// } +// } + +export default App; diff --git a/src/app/Uim.tsx b/src/app/Uim.tsx index aa06ebebe..2b1796e22 100644 --- a/src/app/Uim.tsx +++ b/src/app/Uim.tsx @@ -2,14 +2,17 @@ import AccountCircle from "@mui/icons-material/AccountCircle"; import AccountCircleOutlined from "@mui/icons-material/AccountCircleOutlined"; import CloseIcon from "@mui/icons-material/Close"; import Modal from "@mui/material/Modal"; -import React, { useState, useContext } from "react"; +import React, { useState, useContext, ReactNode } from "react"; import AppContext, { AppContextValue } from "app/AppContext"; import Login from "app/uim/Login"; import UserInfo from "app/uim/UserInfo"; import ConfirmationModal from "components/ConfirmationModal"; -import { UimProps } from "types/uimTypes"; +//import { UimProps } from "types/uimTypes"; +interface UimProps { + setUser: (res: null | Response ) => React.ReactNode | void; +} interface LogModalsTypes { loginModal: boolean; @@ -23,6 +26,8 @@ const defaultModalsValues: LogModalsTypes = { userModal: false, }; + + const Uim: React.FC = ({ setUser }) => { const [modals, setModals] = useState(defaultModalsValues); diff --git a/src/app/uim/Login.tsx b/src/app/uim/Login.tsx index b178e1740..6d134a166 100644 --- a/src/app/uim/Login.tsx +++ b/src/app/uim/Login.tsx @@ -2,7 +2,10 @@ import React, { useState } from "react"; import RestAPI from "utils/restAPI"; -import { UimProps } from "types/uimTypes"; +//import { UimProps } from "types/uimTypes"; +interface LoginProps { + setUser: (res: Response ) => React.ReactNode | void; +} interface StateLoginValues { username: string; @@ -14,7 +17,7 @@ const defaultStateValues: StateLoginValues = { password: "", }; -const Login: React.FC = ({ setUser }) => { +const Login: React.FC = ({ setUser }) => { const [userValues, setUserValues] = useState(defaultStateValues); From 169b96be9f1b7b2c99e97fc4e3016ff3862be9ae Mon Sep 17 00:00:00 2001 From: hache Date: Fri, 10 Nov 2023 14:44:33 -0500 Subject: [PATCH 2/6] Add typesin App component functional --- src/App.tsx | 335 ++++++++++++------------------------------ src/app/Uim.tsx | 5 +- src/app/uim/Login.tsx | 5 +- src/types/uimTypes.ts | 3 - 4 files changed, 97 insertions(+), 251 deletions(-) delete mode 100644 src/types/uimTypes.ts diff --git a/src/App.tsx b/src/App.tsx index 712dadfcd..752e6f11b 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -1,303 +1,156 @@ -import React, {useState, useEffect, ReactNode} from 'react'; -import { Switch, Route, Redirect } from 'react-router-dom'; +import React, { useState, useEffect } from "react"; +import { Switch, Route, Redirect, useLocation } from "react-router-dom"; -import AppContext from 'app/AppContext'; -import Layout from 'app/Layout'; -import Uim from 'app/Uim'; -import Compensation from 'pages/Compensation'; -import Home from 'pages/Home'; -import Search from 'pages/Search'; -import CBMDashboard from 'pages/CBMDashboard'; -import Indicator from 'pages/Indicator'; -import Portfolio from 'pages/Portfolio'; +import AppContext from "app/AppContext"; +import Layout from "app/Layout"; +import Uim from "app/Uim"; +import Compensation from "pages/Compensation"; +import Home from "pages/Home"; +import Search from "pages/Search"; +import CBMDashboard from "pages/CBMDashboard"; +import Indicator from "pages/Indicator"; +import Portfolio from "pages/Portfolio"; -import 'main.css'; -import 'cbm-dashboard/dist/bundle.css'; -import 'indicators/dist/bundle.css'; +import "main.css"; +import "cbm-dashboard/dist/bundle.css"; +import "indicators/dist/bundle.css"; -import isFlagEnabled from 'utils/isFlagEnabled'; +import isFlagEnabled from "utils/isFlagEnabled"; import { LogosConfig } from "types/layoutTypes"; -import * as H from 'history'; - - // {hash: "" - // key: "wk98il" - // pathname: "/" - // search: "" - // state: undefined} - -interface LocationTypes { - hash: string; - key: string; - pathname: string; - search: string; - state: undefined; - referrer?: string; -} interface LoadComponentTypes { logoSet: keyof LogosConfig | null; name: string; - component: ReactNode; + component: React.ReactNode; className: string; } -const App = (props:any) => { - const [user, setUser] = useState(null); - const [headerNames,setHeaderNames] = useState({}); - const [showCBMDashboard, setShowCBMDashboard] = useState(false); -console.log(props); +const App: React.FunctionComponent = () => { + const [user, setUser] = useState(null); + const [headerNames, setHeaderNames] = useState({}); + const [showCBMDashboard, setShowCBMDashboard] = useState(false); + + const location = useLocation(); + useEffect(() => { - isFlagEnabled('CBMModule') - .then((value) => setShowCBMDashboard( value )) - }, []) + isFlagEnabled("CBMModule").then((value) => setShowCBMDashboard(value)); + }, []); const buildQuery = (queryString: string) => new URLSearchParams(queryString); - const setMyUser = () => setUser( user ); + const setUserFunc = (user: null | Response | any): void => setUser(user); - const setMyHeaderNames = (parent: string, child: string) => { + const setHeaderNamesFunc = (parent: string, child: string) => { setHeaderNames({ headerNames: { parent, child }, }); - } + }; - const loadHome = ({location}:any) => ( + const loadHome = () => loadComponent({ - logoSet: 'default', - name:'', - component: (), - className: 'fullgrid', - }) - ); + logoSet: "default", + name: "", + component: , + className: "fullgrid", + }); - const loadSearch = ({location}:any) => { + const loadSearch = () => { const query = buildQuery(location.search); return loadComponent({ logoSet: null, - name: 'Consultas geográficas', - component: (), - className: 'fullgrid', + name: "Consultas geográficas", + component: ( + + ), + className: "fullgrid", }); - } + }; - const loadIndicator = () => ( + const loadIndicator = () => loadComponent({ logoSet: null, - name: 'Indicadores', - component: (), - className: 'fullgrid', - }) - ); + name: "Indicadores", + component: , + className: "fullgrid", + }); - const loadCompensator = ({location}:any) => { + const loadCompensator = () => { if (user) { return loadComponent({ logoSet: null, - name: 'Compensación ambiental', - component: (), - className: 'fullgrid', + name: "Compensación ambiental", + component: , + className: "fullgrid", }); } return ( ); - } + }; - const loadPortfolio = () => ( + const loadPortfolio = () => loadComponent({ logoSet: null, - name: 'Portafolios', - component: (), - className: 'fullgrid', - }) - ); + name: "Portafolios", + component: , + className: "fullgrid", + }); - const loadCBMDashboard = () => ( + const loadCBMDashboard = () => loadComponent({ - logoSet: 'monitoreo', - name: 'Monitoreo comunitario', - component: (), - className: 'fullgrid', - }) - ); + logoSet: "monitoreo", + name: "Monitoreo comunitario", + component: , + className: "fullgrid", + }); const loadComponent = ({ - logoSet, name, component, className = '', + logoSet, + name, + component, + className = "", }: LoadComponentTypes) => { return ( } + uim={} className={className} > {component} ); - } - - return ( - -
- - - - - - - - - -
-
- ); -} - -// class App2 extends React.Component { -// constructor(props) { -// super(props); -// this.state = { -// user: null, -// headerNames: {}, -// showCBMDashboard: false -// }; -// } - -// componentDidMount() { -// isFlagEnabled('CBMModule') -// .then((value) => this.setState({ showCBMDashboard: value })) -// } - -// buildQuery = (queryString) => new URLSearchParams(queryString); - - -// setUser = (user) => this.setState({ user }); - -// setHeaderNames = (parent, child) => { -// this.setState({ -// headerNames: { parent, child }, -// }); -// } - -// loadHome = ({ location }) => ( -// this.loadComponent({ -// logoSet: 'default', -// name:'', -// component: (), -// }) -// ); - -// loadSearch = ({ location }) => { -// const query = this.buildQuery(location.search); -// return this.loadComponent({ -// logoSet: null, -// name: 'Consultas geográficas', -// component: (), -// className: 'fullgrid', -// }); -// } - -// loadIndicator = () => ( -// this.loadComponent({ -// logoSet: null, -// name: 'Indicadores', -// component: (), -// className: 'fullgrid', -// }) -// ); - -// loadCompensator = ({ location }) => { -// const { user } = this.state; -// if (user) { -// return this.loadComponent({ -// logoSet: null, -// name: 'Compensación ambiental', -// component: (), -// className: 'fullgrid', -// }); -// } -// return ( -// -// ); -// } - -// loadPortfolio = () => ( -// this.loadComponent({ -// logoSet: null, -// name: 'Portafolios', -// component: (), -// className: 'fullgrid', -// }) -// ); - -// loadCBMDashboard = () => ( -// this.loadComponent({ -// logoSet: 'monitoreo', -// name: 'Monitoreo comunitario', -// component: (), -// className: 'fullgrid', -// }) -// ); - -// loadComponent = ({ -// logoSet, name, component, className = '', -// }) => { -// const { headerNames } = this.state; -// return ( -// } -// className={className} -// > -// {component} -// -// ); -// } - -// render() { -// const { user, showCBMDashboard } = this.state; -// return ( -// -//
-// -// -// -// -// -// -// -// -// -//
-//
-// ); -// } -// } + }; + + return ( + +
+ + + + + + + + + +
+
+ ); +}; export default App; diff --git a/src/app/Uim.tsx b/src/app/Uim.tsx index 2b1796e22..a2ade1bf0 100644 --- a/src/app/Uim.tsx +++ b/src/app/Uim.tsx @@ -9,9 +9,8 @@ import Login from "app/uim/Login"; import UserInfo from "app/uim/UserInfo"; import ConfirmationModal from "components/ConfirmationModal"; -//import { UimProps } from "types/uimTypes"; interface UimProps { - setUser: (res: null | Response ) => React.ReactNode | void; + setUser: (res: Response | null) => React.ReactNode | void; } interface LogModalsTypes { @@ -26,8 +25,6 @@ const defaultModalsValues: LogModalsTypes = { userModal: false, }; - - const Uim: React.FC = ({ setUser }) => { const [modals, setModals] = useState(defaultModalsValues); diff --git a/src/app/uim/Login.tsx b/src/app/uim/Login.tsx index 6d134a166..8e055f10b 100644 --- a/src/app/uim/Login.tsx +++ b/src/app/uim/Login.tsx @@ -2,9 +2,8 @@ import React, { useState } from "react"; import RestAPI from "utils/restAPI"; -//import { UimProps } from "types/uimTypes"; interface LoginProps { - setUser: (res: Response ) => React.ReactNode | void; + setUser: (res: Response) => React.ReactNode | void; } interface StateLoginValues { @@ -56,7 +55,7 @@ const Login: React.FC = ({ setUser }) => { type="submit" onClick={() => { RestAPI.requestUser(userValues.username, userValues.password).then( - (res) => setUser(res) + (res: Response) => setUser(res) ); }} > diff --git a/src/types/uimTypes.ts b/src/types/uimTypes.ts deleted file mode 100644 index 9e5c8bd7b..000000000 --- a/src/types/uimTypes.ts +++ /dev/null @@ -1,3 +0,0 @@ -export interface UimProps { - setUser: (res: Response | null) => React.ReactNode; -} From f8644dbbb2895772550aacd6bdfe1ba5ad458bff Mon Sep 17 00:00:00 2001 From: hache Date: Thu, 16 Nov 2023 14:23:49 -0500 Subject: [PATCH 3/6] modify login component --- src/app/uim/Login.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/app/uim/Login.tsx b/src/app/uim/Login.tsx index 8e055f10b..d2071f74e 100644 --- a/src/app/uim/Login.tsx +++ b/src/app/uim/Login.tsx @@ -3,7 +3,7 @@ import React, { useState } from "react"; import RestAPI from "utils/restAPI"; interface LoginProps { - setUser: (res: Response) => React.ReactNode | void; + setUser: (res: Response) => React.ReactNode | void } interface StateLoginValues { From 37d15f5ef2e5bf5753be82e34361498332208549 Mon Sep 17 00:00:00 2001 From: hache Date: Thu, 16 Nov 2023 17:21:01 -0500 Subject: [PATCH 4/6] Add response type on new folder --- src/App.tsx | 9 +++++---- src/app/Uim.tsx | 8 +++----- src/app/uim/Login.tsx | 8 +++----- src/types/loginUimProps.ts | 14 ++++++++++++++ 4 files changed, 25 insertions(+), 14 deletions(-) create mode 100644 src/types/loginUimProps.ts diff --git a/src/App.tsx b/src/App.tsx index 752e6f11b..5dab8c19c 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -19,15 +19,17 @@ import isFlagEnabled from "utils/isFlagEnabled"; import { LogosConfig } from "types/layoutTypes"; +import { UserTypes } from "types/loginUimProps"; + interface LoadComponentTypes { logoSet: keyof LogosConfig | null; name: string; component: React.ReactNode; - className: string; + className?: string; } const App: React.FunctionComponent = () => { - const [user, setUser] = useState(null); + const [user, setUser] = useState(null); const [headerNames, setHeaderNames] = useState({}); const [showCBMDashboard, setShowCBMDashboard] = useState(false); @@ -39,7 +41,7 @@ const App: React.FunctionComponent = () => { const buildQuery = (queryString: string) => new URLSearchParams(queryString); - const setUserFunc = (user: null | Response | any): void => setUser(user); + const setUserFunc = (user: UserTypes | null) => setUser(user); const setHeaderNamesFunc = (parent: string, child: string) => { setHeaderNames({ @@ -52,7 +54,6 @@ const App: React.FunctionComponent = () => { logoSet: "default", name: "", component: , - className: "fullgrid", }); const loadSearch = () => { diff --git a/src/app/Uim.tsx b/src/app/Uim.tsx index a2ade1bf0..59062d957 100644 --- a/src/app/Uim.tsx +++ b/src/app/Uim.tsx @@ -2,16 +2,14 @@ import AccountCircle from "@mui/icons-material/AccountCircle"; import AccountCircleOutlined from "@mui/icons-material/AccountCircleOutlined"; import CloseIcon from "@mui/icons-material/Close"; import Modal from "@mui/material/Modal"; -import React, { useState, useContext, ReactNode } from "react"; +import React, { useState, useContext } from "react"; import AppContext, { AppContextValue } from "app/AppContext"; import Login from "app/uim/Login"; import UserInfo from "app/uim/UserInfo"; import ConfirmationModal from "components/ConfirmationModal"; -interface UimProps { - setUser: (res: Response | null) => React.ReactNode | void; -} +import { loginUimProps } from "types/loginUimProps"; interface LogModalsTypes { loginModal: boolean; @@ -25,7 +23,7 @@ const defaultModalsValues: LogModalsTypes = { userModal: false, }; -const Uim: React.FC = ({ setUser }) => { +const Uim: React.FC = ({ setUser }) => { const [modals, setModals] = useState(defaultModalsValues); /** diff --git a/src/app/uim/Login.tsx b/src/app/uim/Login.tsx index d2071f74e..bcd04b8ab 100644 --- a/src/app/uim/Login.tsx +++ b/src/app/uim/Login.tsx @@ -2,9 +2,7 @@ import React, { useState } from "react"; import RestAPI from "utils/restAPI"; -interface LoginProps { - setUser: (res: Response) => React.ReactNode | void -} +import { loginUimProps } from "types/loginUimProps"; interface StateLoginValues { username: string; @@ -16,7 +14,7 @@ const defaultStateValues: StateLoginValues = { password: "", }; -const Login: React.FC = ({ setUser }) => { +const Login: React.FC = ({ setUser }) => { const [userValues, setUserValues] = useState(defaultStateValues); @@ -55,7 +53,7 @@ const Login: React.FC = ({ setUser }) => { type="submit" onClick={() => { RestAPI.requestUser(userValues.username, userValues.password).then( - (res: Response) => setUser(res) + (res) => setUser(res) ); }} > diff --git a/src/types/loginUimProps.ts b/src/types/loginUimProps.ts new file mode 100644 index 000000000..b2ddfa947 --- /dev/null +++ b/src/types/loginUimProps.ts @@ -0,0 +1,14 @@ +export interface CompanyTypes { + id: number; +} + +export interface UserTypes { + company?: CompanyTypes; + id: number; + name: string; + username: string; +} + +export interface loginUimProps { + setUser: (res: UserTypes | null) => void; +} From fbcbb52310c7426757f7a250dd28b16c4ac0aea4 Mon Sep 17 00:00:00 2001 From: hache Date: Fri, 17 Nov 2023 09:36:17 -0500 Subject: [PATCH 5/6] Delete export on logingUimProps file --- src/types/loginUimProps.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/types/loginUimProps.ts b/src/types/loginUimProps.ts index b2ddfa947..b50c39995 100644 --- a/src/types/loginUimProps.ts +++ b/src/types/loginUimProps.ts @@ -1,4 +1,4 @@ -export interface CompanyTypes { +interface CompanyTypes { id: number; } From 358447a0ffe4cddbdb52a9dbb655ed824144adcd Mon Sep 17 00:00:00 2001 From: hache Date: Fri, 17 Nov 2023 10:37:53 -0500 Subject: [PATCH 6/6] Delete setUserFunc function --- src/App.tsx | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/App.tsx b/src/App.tsx index 5dab8c19c..8a2878113 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -41,8 +41,6 @@ const App: React.FunctionComponent = () => { const buildQuery = (queryString: string) => new URLSearchParams(queryString); - const setUserFunc = (user: UserTypes | null) => setUser(user); - const setHeaderNamesFunc = (parent: string, child: string) => { setHeaderNames({ headerNames: { parent, child }, @@ -126,7 +124,7 @@ const App: React.FunctionComponent = () => { moduleName={name} footerLogos={logoSet} headerNames={headerNames} - uim={} + uim={} className={className} > {component}