Skip to content

Commit

Permalink
try to avoid using hash in API calls for internal links
Browse files Browse the repository at this point in the history
Signed-off-by: Christian Hartmann <chris-hartmann@gmx.de>
  • Loading branch information
Chartman123 committed Aug 30, 2024
1 parent f061cab commit afcac54
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
9 changes: 6 additions & 3 deletions lib/Controller/PageController.php
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand All @@ -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);
}

/**
Expand Down
4 changes: 2 additions & 2 deletions src/Forms.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit afcac54

Please sign in to comment.