Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[stable30] fix: display error at same route #4509

Merged
merged 1 commit into from
Jan 28, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
<NcContent app-name="libresign" :class="{'sign-external-page': isSignExternalPage}">
<LeftSidebar />
<NcAppContent :class="{'icon-loading' : loading }">
<router-view v-if="!loading" :key="$route.name " :loading.sync="loading" />
<DefaultPageError v-if="isDoNothingError" />
<router-view v-else-if="!loading" :key="$route.name " :loading.sync="loading" />
<NcEmptyContent v-if="isRoot" :description="t('libresign', 'LibreSign, digital signature app for Nextcloud.')">
<template #icon>
<img :src="LogoLibreSign">
Expand All @@ -25,6 +26,7 @@ import NcEmptyContent from '@nextcloud/vue/dist/Components/NcEmptyContent.js'

import LeftSidebar from './Components/LeftSidebar/LeftSidebar.vue'
import RightSidebar from './Components/RightSidebar/RightSidebar.vue'
import DefaultPageError from './views/DefaultPageError.vue'

import LogoLibreSign from './../img/logo-gray.svg'

Expand All @@ -36,6 +38,7 @@ export default {
NcEmptyContent,
LeftSidebar,
RightSidebar,
DefaultPageError,
},
data() {
return {
Expand All @@ -50,6 +53,9 @@ export default {
isSignExternalPage() {
return this.$route.path.startsWith('/p/')
},
isDoNothingError() {
return this.$route.params?.action === 2000
},
},
}
</script>
Expand Down
2 changes: 1 addition & 1 deletion src/helpers/SelectAction.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export const selectAction = (action, to, from) => {
case 1500: // ACTION_CREATE_ACCOUNT
return 'CreateAccount' + external
case 2000: // ACTION_DO_NOTHING
return 'DefaultPageError' + external
return to.name
case 2500: // ACTION_SIGN
return 'SignPDF' + external
case 2625: // ACTION_SIGN_INTERNAL
Expand Down
11 changes: 9 additions & 2 deletions src/router/router.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ const router = new Router({
props: true,
},
{
path: '/p/sign/:uuid/error',
path: '/p/error',
name: 'DefaultPageErrorExternal',
component: () => import('../views/DefaultPageError.vue'),
props: true,
Expand All @@ -79,6 +79,12 @@ const router = new Router({
component: () => import('../views/Validation.vue'),
props: true,
},
{
path: '/validation/:uuid',
name: 'ValidationFileShortUrl',
component: () => import('../views/Validation.vue'),
props: true,
},
{
path: '/p/incomplete',
name: 'IncompleteExternal',
Expand Down Expand Up @@ -191,7 +197,8 @@ router.beforeEach((to, from, next) => {
const actionElement = document.querySelector('#initial-state-libresign-action')
let action
if (actionElement) {
action = selectAction(loadState('libresign', 'action', ''), to, from)
to.params.action = loadState('libresign', 'action', '')
action = selectAction(to.params.action, to, from)
document.querySelector('#initial-state-libresign-action')?.remove()
}
if (Object.hasOwn(to, 'name') && typeof to.name === 'string' && !to.name.endsWith('External') && isExternal(to, from)) {
Expand Down