mirror of
https://github.com/MarijnDoeve/TijdVoorDeTest.git
synced 2026-07-07 08:00:15 +02:00
15 lines
401 B
JavaScript
15 lines
401 B
JavaScript
import {Controller} from '@hotwired/stimulus';
|
|
|
|
export default class extends Controller {
|
|
next() {
|
|
const currentUrl = new URL(window.location.href);
|
|
const pathParts = currentUrl.pathname.split('/');
|
|
// Remove the last segment
|
|
pathParts.pop();
|
|
// Update the pathname
|
|
currentUrl.pathname = pathParts.join('/');
|
|
// Navigate
|
|
window.location.href = currentUrl.href;
|
|
}
|
|
}
|