|
|
|
@ -19,6 +19,15 @@ const menuMap = { |
|
|
|
currentUser: user.currentUser, |
|
|
|
})) |
|
|
|
export default class Info extends Component { |
|
|
|
static getDerivedStateFromProps(props, state) { |
|
|
|
const { match, location } = props; |
|
|
|
let selectKey = location.pathname.replace(`${match.path}/`, ''); |
|
|
|
selectKey = menuMap[selectKey] ? selectKey : 'base'; |
|
|
|
if (selectKey !== state.selectKey) { |
|
|
|
return { selectKey }; |
|
|
|
} |
|
|
|
return null; |
|
|
|
} |
|
|
|
constructor(props) { |
|
|
|
super(props); |
|
|
|
const { match, location } = props; |
|
|
|
|