mirror of
https://github.com/baserow/baserow.git
synced 2026-12-04 00:08:25 +00:00
18 lines
552 B
JavaScript
18 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)
|
|
}
|
|
}
|