mirror of
https://gitlab.com/bramw/baserow.git
synced 2025-01-15 21:18:41 +00:00
17 lines
552 B
JavaScript
17 lines
552 B
JavaScript
/**
|
|
* Middleware that changes the dashboard loading state to true before the route
|
|
* changes.
|
|
*/
|
|
export default async function ({ route, from, store, app }) {
|
|
function parseIntOrNull(x) {
|
|
return x != null ? parseInt(x) : null
|
|
}
|
|
|
|
const toDashboardId = parseIntOrNull(route?.params?.dashboardId)
|
|
const fromDashboardId = parseIntOrNull(from?.params?.dashboardId)
|
|
const differentDashboardId = fromDashboardId !== toDashboardId
|
|
|
|
if (!from || differentDashboardId) {
|
|
await store.dispatch('dashboardApplication/setLoading', true)
|
|
}
|
|
}
|