This commit is contained in:
Malai Raja
2023-12-01 10:32:28 +05:30
parent b3371d3bc0
commit 2aab086a66
16 changed files with 152 additions and 52 deletions

4
.env.development Normal file
View File

@@ -0,0 +1,4 @@
REACT_APP_URL='https://jupiter.nearle.app/live/api/v1'
REACT_APP_URL2=''
REACT_APP_STAFF_TOKEN=''

3
.env.staging Normal file
View File

@@ -0,0 +1,3 @@
REACT_APP_URL=''
REACT_APP_URL2=''
REACT_APP_STAFF_TOKEN=''

1
nearlexpressbuild Submodule

Submodule nearlexpressbuild added at dcb5535260

40
package-lock.json generated
View File

@@ -22,6 +22,7 @@
"buffer": "^6.0.3",
"chance": "^1.1.11",
"crypto-browserify": "^3.12.0",
"env-cmd": "^10.1.0",
"formik": "^2.2.9",
"framer-motion": "^10.12.4",
"jsonwebtoken": "^9.0.0",
@@ -7687,6 +7688,29 @@
"url": "https://github.com/fb55/entities?sponsor=1"
}
},
"node_modules/env-cmd": {
"version": "10.1.0",
"resolved": "https://registry.npmjs.org/env-cmd/-/env-cmd-10.1.0.tgz",
"integrity": "sha512-mMdWTT9XKN7yNth/6N6g2GuKuJTsKMDHlQFUDacb/heQRRWOTIZ42t1rMHnQu4jYxU1ajdTeJM+9eEETlqToMA==",
"dependencies": {
"commander": "^4.0.0",
"cross-spawn": "^7.0.0"
},
"bin": {
"env-cmd": "bin/env-cmd.js"
},
"engines": {
"node": ">=8.0.0"
}
},
"node_modules/env-cmd/node_modules/commander": {
"version": "4.1.1",
"resolved": "https://registry.npmjs.org/commander/-/commander-4.1.1.tgz",
"integrity": "sha512-NOKm8xhkzAjzFx8B2v5OAHT+u5pRQc2UCa2Vq9jYL/31o2wi9mxBA7LIFs3sV5VSC49z6pEhfbMULvShKj26WA==",
"engines": {
"node": ">= 6"
}
},
"node_modules/error-ex": {
"version": "1.3.2",
"resolved": "https://registry.npmjs.org/error-ex/-/error-ex-1.3.2.tgz",
@@ -24645,6 +24669,22 @@
"resolved": "https://registry.npmjs.org/entities/-/entities-2.2.0.tgz",
"integrity": "sha512-p92if5Nz619I0w+akJrLZH0MX0Pb5DX39XOwQTtXSdQQOaYH03S1uIQp4mhOZtAXrxq4ViO67YTiLBo2638o9A=="
},
"env-cmd": {
"version": "10.1.0",
"resolved": "https://registry.npmjs.org/env-cmd/-/env-cmd-10.1.0.tgz",
"integrity": "sha512-mMdWTT9XKN7yNth/6N6g2GuKuJTsKMDHlQFUDacb/heQRRWOTIZ42t1rMHnQu4jYxU1ajdTeJM+9eEETlqToMA==",
"requires": {
"commander": "^4.0.0",
"cross-spawn": "^7.0.0"
},
"dependencies": {
"commander": {
"version": "4.1.1",
"resolved": "https://registry.npmjs.org/commander/-/commander-4.1.1.tgz",
"integrity": "sha512-NOKm8xhkzAjzFx8B2v5OAHT+u5pRQc2UCa2Vq9jYL/31o2wi9mxBA7LIFs3sV5VSC49z6pEhfbMULvShKj26WA=="
}
}
},
"error-ex": {
"version": "1.3.2",
"resolved": "https://registry.npmjs.org/error-ex/-/error-ex-1.3.2.tgz",

View File

@@ -17,6 +17,7 @@
"buffer": "^6.0.3",
"chance": "^1.1.11",
"crypto-browserify": "^3.12.0",
"env-cmd": "^10.1.0",
"formik": "^2.2.9",
"framer-motion": "^10.12.4",
"jsonwebtoken": "^9.0.0",
@@ -49,7 +50,11 @@
"start": "react-app-rewired start",
"build": "react-app-rewired build",
"test": "react-scripts test",
"eject": "react-scripts eject"
"eject": "react-scripts eject",
"start:dev": "env-cmd -f .env.development react-app-rewired start",
"start:staging": "env-cmd -f .env.staging react-app-rewired start",
"build:dev": "env-cmd -f .env.development react-app-rewired build",
"build:staging": "env-cmd -f .env.staging react-app-rewired build"
},
"eslintConfig": {
"extends": [

View File

@@ -5,7 +5,7 @@
<link rel="icon" href="%PUBLIC_URL%/favicon.png" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="theme-color" content="#000000" />
<meta name="description" content="Web site created using create-react-app" />
<meta name="description" content="Nearle" />
<link rel="apple-touch-icon" href="%PUBLIC_URL%/logo192.png" />
<!--

View File

@@ -16,11 +16,11 @@ import { useEffect } from 'react';
const App = () =>{
let navigate=useNavigate()
// useEffect(()=>{
// if (!localStorage.getItem("firstname")) {
// navigate('/login')
// }
// },[])
useEffect(()=>{
if (!localStorage.getItem("authname")) {
navigate('/login')
}
},[])
return <>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.4 KiB

After

Width:  |  Height:  |  Size: 4.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.4 KiB

View File

@@ -36,19 +36,19 @@ const ProfileTab = ({ handleLogout }) => {
<ListItemIcon>
<ProfileOutlined />
</ListItemIcon>
<ListItemText primary="Social Profile" />
<ListItemText primary="Account Settings" />
</ListItemButton>
<ListItemButton selected={selectedIndex === 4} onClick={(event) => handleListItemClick(event, 4)}>
{/* <ListItemButton selected={selectedIndex === 4} onClick={(event) => handleListItemClick(event, 4)}>
<ListItemIcon>
<WalletOutlined />
</ListItemIcon>
<ListItemText primary="Billing" />
</ListItemButton>
</ListItemButton> */}
<ListItemButton selected={selectedIndex === 2}
// onClick={handleLogout}
onClick={()=>{
navigate('/login')
}}
onClick={handleLogout}
// onClick={()=>{
// navigate('/login')
// }}
>
<ListItemIcon>
<LogoutOutlined />

View File

@@ -52,12 +52,20 @@ const Profile = () => {
// const { logout, user } = useAuth();
const handleLogout = async () => {
try {
await logout();
navigate(`/login`, {
state: {
from: ''
}
});
// await logout();
// navigate(`/login`, {
// state: {
// from: ''
// }
// });
localStorage.removeItem('firstname');
localStorage.removeItem('appuserid');
localStorage.removeItem('authname');
localStorage.removeItem('roleid');
navigate('/login')
} catch (err) {
console.error(err);
}
@@ -153,14 +161,20 @@ const Profile = () => {
{/* {user?.name} */}
</Typography>
<Typography variant="body2" color="textSecondary">
UI/UX Designer
{/* UI/UX Designer */}
user
</Typography>
</Stack>
</Stack>
</Grid>
<Grid item>
<Tooltip title="Logout">
<IconButton size="large" sx={{ color: 'text.primary' }} onClick={handleLogout}>
<IconButton size="large" sx={{ color: 'text.primary' }}
// onClick={handleLogout}>
onClick={()=>{
handleLogout()
}}>
<LogoutOutlined />
</IconButton>
</Tooltip>
@@ -182,7 +196,7 @@ const Profile = () => {
label="Profile"
{...a11yProps(0)}
/>
<Tab
{/* <Tab
sx={{
display: 'flex',
flexDirection: 'row',
@@ -193,7 +207,7 @@ const Profile = () => {
icon={<SettingOutlined style={{ marginBottom: 0, marginRight: '10px' }} />}
label="Setting"
{...a11yProps(1)}
/>
/> */}
</Tabs>
</Box>
<TabPanel value={value} index={0} dir={theme.direction}>

View File

@@ -29,7 +29,7 @@ const HeaderContent = () => {
{matchesXs && <Box sx={{ width: '100%', ml: 1 }} />}
<Notification />
<Message />
{/* <Message /> */}
{!matchesXs && <Profile />}
{matchesXs && <MobileSection />}
</Stack>

View File

@@ -63,11 +63,13 @@ const Login = () => {
// }, [toast])
useEffect(() => {
if (localStorage.getItem("firstname") || localStorage.getItem("appuserid")) {
if (localStorage.getItem("authname")
// || localStorage.getItem("appuserid")
) {
navigate('/dashboard')
}
console.log(alertmessage)
// console.log(alertmessage)
}, [])
const usernamecheck = async (e) => {
@@ -78,17 +80,20 @@ const Login = () => {
// await axios.post(`${process.env.REACT_APP_URL}/auth/login`, {
// "authname": e.target.value
// })
await axios.post(`${process.env.REACT_APP_URL2}/users/login`, {
await axios.post(`${process.env.REACT_APP_URL}/users/login`, {
"authname": e.target.value,
"configid":3,
// "password":'admi'
"configid":1,
"password":'admin'
})
.then((res) => {
console.log(res.data);
if (res.data.userinfo.authname === e.target.value) {
console.log(res.data)
if (res.data.details.authname === e.target.value) {
setUsername(e.target.value);
setCheckusername(false);
}else{
setCheckusername(true);
}
// if (res.data.authname === e.target.value) {
@@ -96,10 +101,10 @@ const Login = () => {
// setCheckusername(false);
// }
}).catch((err) => {
if (err.response.data.message === 'No user found') {
// if (err.response.data.message === 'No user found') {
setCheckusername(true);
}
// }
})
} catch (err) {
console.log(err)
@@ -115,13 +120,13 @@ const Login = () => {
if (password && username) {
setSubmitting(true)
try {
await axios.post(`${process.env.REACT_APP_URL2}/users/login`, {
await axios.post(`${process.env.REACT_APP_URL}/users/login`, {
"authname": username,
"configid":3,
"configid":1,
"password": password
}).then((res) => {
console.log(res.data)
if (res.data.userinfo.authname === username) {
if (res.data.details.authname === username) {
// setAlertmessage('login Successfull');
setLoading(false)
// dispatch(
@@ -141,12 +146,14 @@ const Login = () => {
})
setUsername('');
setPassword('');
localStorage.setItem("firstname", res.data.userinfo.firstname);
localStorage.setItem("appuserid", res.data.userinfo.userid);
localStorage.setItem("roleid", res.data.userinfo.roleid);
localStorage.setItem("firstname", res.data.details.firstname);
localStorage.setItem("authname", res.data.details.authname);
localStorage.setItem("appuserid", res.data.details.userid);
localStorage.setItem("roleid", res.data.details.roleid);
navigate('/dashboard', { state: { firstname: res.data.userinfo.firstname } });
navigate('/dashboard');
setSubmitting(false)
}
}).catch((err) => {
@@ -226,7 +233,9 @@ const Login = () => {
container
justifyContent="center"
alignItems="center"
sx={{ minHeight: { xs: 'calc(100vh - 210px)', sm: 'calc(100vh - 134px)', md: 'calc(100vh - 112px)' } }}
// sx={{ minHeight: { xs: 'calc(100vh - 210px)', sm: 'calc(100vh - 134px)', md: 'calc(100vh - 112px)' } }}
sx={{ minHeight: { xs: 'calc(100vh - 210px)', sm: 'calc(100vh - 134px)', md: 'calc(100vh - 132px)' } }}
>
<Grid item>
{/* <AuthCard>{children}</AuthCard> */}
@@ -398,8 +407,8 @@ const Login = () => {
disabled={submitting}
onClick={()=>{
// loginsend()
navigate('/dashboard')
loginsend()
// navigate('/dashboard')
}}
fullWidth size="large" type="submit" variant="contained" color="primary">
Login

View File

@@ -1,9 +1,9 @@
// import { lazy } from 'react';
import { lazy } from 'react';
// project import
// import GuestGuard from 'utils/route-guard/GuestGuard';
import CommonLayout from 'layout/CommonLayout';
// import Loadable from 'components/Loadable';
import Loadable from 'components/Loadable';
// render - login
// const AuthLogin = Loadable(lazy(() => import('pages/auth/login')));
@@ -12,6 +12,7 @@ import CommonLayout from 'layout/CommonLayout';
// const AuthCheckMail = Loadable(lazy(() => import('pages/auth/check-mail')));
// const AuthResetPassword = Loadable(lazy(() => import('pages/auth/reset-password')));
// const AuthCodeVerification = Loadable(lazy(() => import('pages/auth/code-verification')));
const Login = Loadable(lazy(() => import('pages/nearle/login')));
// ==============================|| AUTH ROUTING ||============================== //
@@ -26,6 +27,14 @@ const LoginRoutes = {
// </GuestGuard>
),
children: [
{
path: '/',
element: <Login />
},
{
path: 'login',
element: <Login />
},
// {
// path: '/',
// element: <AuthLogin />
@@ -55,7 +64,8 @@ const LoginRoutes = {
// element: <AuthCodeVerification />
// }
]
}
},
]
};

View File

@@ -32,10 +32,10 @@ const MainRoutes = {
// </AuthGuard>
),
children: [
{
path: 'sample-page',
element: <SamplePage />
},
// {
// path: 'sample-page',
// element: <SamplePage />
// },
{
path: 'dashboard',
element: <Dashboard />
@@ -43,6 +43,7 @@ const MainRoutes = {
]
},
{
path:'/login',
element:<Login />

View File

@@ -3758,6 +3758,11 @@ commander@^2.20.0:
resolved "https://registry.npmjs.org/commander/-/commander-2.20.3.tgz"
integrity sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==
commander@^4.0.0:
version "4.1.1"
resolved "https://registry.npmjs.org/commander/-/commander-4.1.1.tgz"
integrity sha512-NOKm8xhkzAjzFx8B2v5OAHT+u5pRQc2UCa2Vq9jYL/31o2wi9mxBA7LIFs3sV5VSC49z6pEhfbMULvShKj26WA==
commander@^7.2.0:
version "7.2.0"
resolved "https://registry.npmjs.org/commander/-/commander-7.2.0.tgz"
@@ -3932,7 +3937,7 @@ create-hmac@^1.1.0, create-hmac@^1.1.4, create-hmac@^1.1.7:
safe-buffer "^5.0.1"
sha.js "^2.4.8"
cross-spawn@^7.0.2, cross-spawn@^7.0.3:
cross-spawn@^7.0.0, cross-spawn@^7.0.2, cross-spawn@^7.0.3:
version "7.0.3"
resolved "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz"
integrity sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==
@@ -4635,6 +4640,14 @@ entities@^4.4.0:
resolved "https://registry.npmjs.org/entities/-/entities-4.5.0.tgz"
integrity sha512-V0hjH4dGPh9Ao5p0MoRY6BVqtwCjhz6vI5LT8AJ55H+4g9/4vbHx1I54fS0XuclLhDHArPQCiMjDxjaL8fPxhw==
env-cmd@^10.1.0:
version "10.1.0"
resolved "https://registry.npmjs.org/env-cmd/-/env-cmd-10.1.0.tgz"
integrity sha512-mMdWTT9XKN7yNth/6N6g2GuKuJTsKMDHlQFUDacb/heQRRWOTIZ42t1rMHnQu4jYxU1ajdTeJM+9eEETlqToMA==
dependencies:
commander "^4.0.0"
cross-spawn "^7.0.0"
error-ex@^1.3.1:
version "1.3.2"
resolved "https://registry.npmjs.org/error-ex/-/error-ex-1.3.2.tgz"