Kirby 3.6: vue-router has been completely removed, use Panel areas to define custom Panel routes

In Kirby 3.6 changelog it says

vue-router has been completely removed, use Panel areas to define custom Panel routes.

in a Plugin to auto-update the slug and redirect the panel to the new slug there is this line of code in index.js that now throws an error: this.$router.push(redirect)

I have now Idea how to approach this and am grateful for any pointers.

Try

 this.$go(redirect);

Thank you, Sonja. I didn’t get any further with this so turned to this hook:

'page.*:after' => [
      function($newPage, $oldPage) {
        if (in_array($newPage->intendedTemplate()->name(), ['events-list-group', 'events-list-single-item'])) {
          $dateBegin = $newPage->date()->toDate('ymd');

          // get value of date_end field 
          $dateEnd = $newPage->date_end()->toDate('ymd');

          // construct slug
          $slug = $dateBegin . "-" . $dateEnd . "-" . $newPage->title()->value();

          //set slug according to add field title
          $oldPage->changeSlug(Str::slug($slug));

        }
      }
    ]

which works fine, except after saving the page is not redirected to the new slug in the panel.
Is that something, that is now possible with the new Fiber feature? It tried adding Panel::go() at the end of my hook, but then get this error. The slug still gets updated, though.

No, redirecting from the hook is still not possible. The Redirect exeption (used by Panel::go()) can be thrown in Fiber routes but not in hooks.

1 Like

this.$go(redirect);did work, had a bug somewhere else that messed things up. Thanks again, Sonja.