mirror of
https://github.com/chenasraf/nextcloud-app-template.git
synced 2026-05-17 17:28:09 +00:00
fix: catch-all route
This commit is contained in:
@@ -10,6 +10,7 @@ declare(strict_types=1);
|
||||
return [
|
||||
'routes' => [
|
||||
// SPA catch-all routes - serve the main template for all sub-paths
|
||||
['name' => 'page#index', 'url' => '/{path}', 'verb' => 'GET', 'requirements' => ['path' => '.*']],
|
||||
['name' => 'page#index', 'url' => '/', 'verb' => 'GET'],
|
||||
['name' => 'page#catchAll', 'url' => '/{path}', 'verb' => 'GET', 'requirements' => ['path' => '.*']],
|
||||
],
|
||||
];
|
||||
|
||||
@@ -35,9 +35,22 @@ class PageController extends Controller {
|
||||
#[NoAdminRequired]
|
||||
#[NoCSRFRequired]
|
||||
public function index(): TemplateResponse {
|
||||
$this->logger->info('NextcloudAppTemplate main page loaded');
|
||||
$this->logger->info('Forum main page loaded');
|
||||
return new TemplateResponse(Application::APP_ID, 'app', [
|
||||
'script' => 'app',
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Main app page - catch all route
|
||||
*
|
||||
* @return TemplateResponse<Http::STATUS_OK,array{}>
|
||||
*
|
||||
* 200: OK
|
||||
*/
|
||||
#[NoAdminRequired]
|
||||
#[NoCSRFRequired]
|
||||
public function catchAll(string $path = ''): TemplateResponse {
|
||||
return $this->index();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user