Intranet Dashboard
This commit is contained in:
parent
abd72064f1
commit
61b9868126
1 changed files with 16 additions and 1 deletions
|
|
@ -43,6 +43,7 @@ import ShuttleRoute from './widgets/ShuttleRoute'
|
|||
import { useLocalization } from '@/utils/hooks/useLocalization'
|
||||
import useLocale from '@/utils/hooks/useLocale'
|
||||
import { currentLocalDate } from '@/utils/dateUtils'
|
||||
import { useStoreState } from '@/store/store'
|
||||
|
||||
dayjs.extend(relativeTime)
|
||||
dayjs.extend(isBetween)
|
||||
|
|
@ -72,7 +73,9 @@ const IntranetDashboard: React.FC = () => {
|
|||
|
||||
const fetchIntranetDashboard = async () => {
|
||||
const dashboard = await intranetService.getDashboard()
|
||||
setIntranetDashboard(dashboard.data)
|
||||
if (dashboard.data) {
|
||||
setIntranetDashboard(dashboard.data)
|
||||
}
|
||||
}
|
||||
|
||||
useEffect(() => {
|
||||
|
|
@ -161,6 +164,18 @@ const IntranetDashboard: React.FC = () => {
|
|||
}
|
||||
}, [])
|
||||
|
||||
// If permissions arrive after mount, initialize default order when needed
|
||||
const grantedPolicies = useStoreState((state) => state.abpConfig?.config?.auth.grantedPolicies)
|
||||
|
||||
useEffect(() => {
|
||||
if (
|
||||
grantedPolicies &&
|
||||
(!widgetOrder.left.length && !widgetOrder.center.length && !widgetOrder.right.length)
|
||||
) {
|
||||
initializeDefaultOrder()
|
||||
}
|
||||
}, [grantedPolicies])
|
||||
|
||||
const initializeDefaultOrder = () => {
|
||||
const defaultOrder = {
|
||||
left: widgetMetadata
|
||||
|
|
|
|||
Loading…
Reference in a new issue