LMSN-191
Data corporate & member linking ke client portal
This commit is contained in:
@@ -2,6 +2,7 @@ import { FormControl, InputLabel, MenuItem, Select, SelectChangeEvent } from '@m
|
||||
import { useContext, useEffect, useState } from 'react';
|
||||
import { UserCurrentCorporateContext } from '../../../contexts/UserCurrentCorporate';
|
||||
import axios from '../../../utils/axios';
|
||||
import { useNavigate } from 'react-router-dom';
|
||||
|
||||
/* ---------------------------------- types --------------------------------- */
|
||||
type CorporateDataProps = {
|
||||
@@ -13,9 +14,17 @@ type CorporateDataProps = {
|
||||
export default function CorporatePopover() {
|
||||
const { corporateValue, setCorporateValue } = useContext(UserCurrentCorporateContext);
|
||||
const [corporateData, setCorporateData] = useState([]);
|
||||
//Check route in profile
|
||||
const navigate = useNavigate();
|
||||
const currentPathname = window.location.pathname;
|
||||
const desiredPart = currentPathname.split('/')[1];
|
||||
|
||||
const handleCorporateChange = (event: SelectChangeEvent) => {
|
||||
setCorporateValue(event.target.value as string);
|
||||
if(desiredPart === 'user-profile')
|
||||
{
|
||||
navigate('/alarm-center');
|
||||
}
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
|
||||
@@ -26,7 +26,7 @@ export default function NavbarAccount({ isCollapse }: Props) {
|
||||
|
||||
const { user } = useAuth();
|
||||
|
||||
console.log('current user is ', user)
|
||||
// console.log('current user is ', user)
|
||||
return (
|
||||
<Link underline="none" color="inherit">
|
||||
<RootStyle
|
||||
|
||||
Reference in New Issue
Block a user