import { Component, Vue } from 'vue-property-decorator'
import { RouteHelper } from '@/widgets/base/RouteHelper'

@Component({
  beforeRouteEnter(to, from, next) {
    RouteHelper.saveLastLocation(to)
    next()
  },

  beforeRouteUpdate(this: BaseWidgetLayout, to, from, next) {
    RouteHelper.saveWidgetLocation(this.widgetName, to)
    RouteHelper.saveLastLocation(to)
    next()
  },
})
export class BaseWidgetLayout extends Vue {
  widgetName = ''
}
