diff --git a/lib/Controller/PageController.php b/lib/Controller/PageController.php index 2c425d705..a66e8f3ba 100644 --- a/lib/Controller/PageController.php +++ b/lib/Controller/PageController.php @@ -79,13 +79,16 @@ public function __construct( * * @return TemplateResponse */ - public function index(): TemplateResponse { + public function index(?string $hash = null): TemplateResponse { Util::addScript($this->appName, 'forms-main'); Util::addStyle($this->appName, 'forms'); Util::addStyle($this->appName, 'forms-style'); $this->insertHeaderOnIos(); $this->initialState->provideInitialState('maxStringLengths', Constants::MAX_STRING_LENGTHS); $this->initialState->provideInitialState('appConfig', $this->configService->getAppConfig()); + if (isset($hash)) { + $this->initialState->provideInitialState('formId', $this->formMapper->findByHash($hash)->id); + } return new TemplateResponse($this->appName, self::TEMPLATE_MAIN, [ 'id-app-content' => '#app-content-vue', 'id-app-navigation' => '#app-navigation-vue', @@ -98,8 +101,8 @@ public function index(): TemplateResponse { * * @return TemplateResponse */ - public function views(): TemplateResponse { - return $this->index(); + public function views(string $hash): TemplateResponse { + return $this->index($hash); } /** diff --git a/src/Forms.vue b/src/Forms.vue index 25ae6b073..66411b4a1 100644 --- a/src/Forms.vue +++ b/src/Forms.vue @@ -413,8 +413,8 @@ export default { ) { try { const response = await axios.get( - generateOcsUrl('apps/forms/api/v3/forms/0?hash={hash}', { - hash, + generateOcsUrl('apps/forms/api/v3/forms/{id}', { + id: loadState(appName, 'formId'), }), ) const form = OcsResponse2Data(response)