Skip to content

Commit

Permalink
Fix usage of initial state
Browse files Browse the repository at this point in the history
Signed-off-by: Vitor Mattos <vitor@php.rio>
  • Loading branch information
vitormattos authored and backportbot-libresign[bot] committed Apr 10, 2023
1 parent 741ac2e commit afba20b
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 13 deletions.
24 changes: 12 additions & 12 deletions lib/Controller/PageController.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,12 @@ public function __construct(
* @return TemplateResponse
*/
public function index(): TemplateResponse {
$this->initialState->provideInitialState('config', json_encode($this->accountService->getConfig(
$this->initialState->provideInitialState('config', $this->accountService->getConfig(
'file_user_uuid',
$this->request->getParam('uuid'),
$this->userSession->getUser(),
'url'
)));
));

Util::addScript(Application::APP_ID, 'libresign-main');

Expand All @@ -72,12 +72,12 @@ public function index(): TemplateResponse {
* @return TemplateResponse
*/
public function sign($uuid): TemplateResponse {
$this->initialState->provideInitialState('config', json_encode($this->accountService->getConfig(
$this->initialState->provideInitialState('config', $this->accountService->getConfig(
'file_user_uuid',
$uuid,
$this->userSession->getUser(),
'url'
)));
));

Util::addScript(Application::APP_ID, 'libresign-external');
$response = new TemplateResponse(Application::APP_ID, 'external', [], TemplateResponse::RENDER_AS_BASE);
Expand All @@ -97,12 +97,12 @@ public function sign($uuid): TemplateResponse {
* @return TemplateResponse
*/
public function signAccountFile($uuid): TemplateResponse {
$this->initialState->provideInitialState('config', json_encode($this->accountService->getConfig(
$this->initialState->provideInitialState('config', $this->accountService->getConfig(
'file_uuid',
$uuid,
$this->userSession->getUser(),
'url'
)));
));

Util::addScript(Application::APP_ID, 'libresign-external');
$response = new TemplateResponse(Application::APP_ID, 'external', [], TemplateResponse::RENDER_AS_BASE);
Expand Down Expand Up @@ -175,12 +175,12 @@ public function getPdfUser($uuid) {
* @return TemplateResponse
*/
public function validation(): TemplateResponse {
$this->initialState->provideInitialState('config', json_encode($this->accountService->getConfig(
$this->initialState->provideInitialState('config', $this->accountService->getConfig(
'file_user_uuid',
$this->request->getParam('uuid'),
$this->userSession->getUser(),
'url'
)));
));

Util::addScript(Application::APP_ID, 'libresign-validation');
$response = new TemplateResponse(Application::APP_ID, 'validation', [], TemplateResponse::RENDER_AS_BASE);
Expand Down Expand Up @@ -209,12 +209,12 @@ public function validationFileWithShortUrl(): RedirectResponse {
* @return TemplateResponse
*/
public function resetPassword(): TemplateResponse {
$this->initialState->provideInitialState('config', json_encode($this->accountService->getConfig(
$this->initialState->provideInitialState('config', $this->accountService->getConfig(
'file_user_uuid',
$this->request->getParam('uuid'),
$this->userSession->getUser(),
'url'
)));
));

Util::addScript(Application::APP_ID, 'libresign-main');
$response = new TemplateResponse(Application::APP_ID, 'reset_password');
Expand All @@ -230,12 +230,12 @@ public function resetPassword(): TemplateResponse {
* @PublicPage
*/
public function validationFile(string $uuid): TemplateResponse {
$this->initialState->provideInitialState('config', json_encode($this->accountService->getConfig(
$this->initialState->provideInitialState('config', $this->accountService->getConfig(
'file_user_uuid',
$uuid,
$this->userSession->getUser(),
'url'
)));
));

Util::addScript(Application::APP_ID, 'libresign-validation');
$response = new TemplateResponse(Application::APP_ID, 'validation', [], TemplateResponse::RENDER_AS_BASE);
Expand Down
2 changes: 1 addition & 1 deletion src/services/InitialStateService.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { loadState } from '@nextcloud/initial-state'

export const getInitialState = () => {
try {
const initialState = JSON.parse(loadState('libresign', 'config'))
const initialState = loadState('libresign', 'config')
return initialState
} catch (err) {
return console.error('error in loadState: ', err)
Expand Down

0 comments on commit afba20b

Please sign in to comment.