Skip to content

Commit

Permalink
Use two buttons
Browse files Browse the repository at this point in the history
Signed-off-by: John Cowen <[email protected]>
  • Loading branch information
johncowen committed Nov 1, 2023
1 parent edf0e9d commit 6a78b62
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 23 deletions.
15 changes: 1 addition & 14 deletions src/app/application/components/route-view/RouteView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -20,17 +20,6 @@
update: routeUpdate,
replace: routeReplace,
params: routeParams,
back: (...args: RouteReplaceParams) => {
try {
if(win.history.state.back !== null) {
win.history.back()
return
}
} catch(_) {
// passthrough
}
routeReplace(...args)
},
}"
/>
</div>
Expand Down Expand Up @@ -61,7 +50,6 @@ const can = useCan()
const { t } = useI18n()
const route = useRoute()
const router = useRouter()
const win = window
const sym = Symbol('route-view')
const props = withDefaults(defineProps<{
Expand Down Expand Up @@ -152,8 +140,7 @@ const routeUpdate = (params: Record<string, string | undefined>) => {
}
routerPush(newParams)
}
type RouteReplaceParams = Parameters<typeof router['push']>
const routeReplace = (...args: RouteReplaceParams) => {
const routeReplace = (...args: Parameters<typeof router['push']>) => {
router.push(...args)
}
watch(() => props.name, () => {
Expand Down
20 changes: 11 additions & 9 deletions src/app/zones/views/CreateView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -21,17 +21,19 @@

<template #actions>
<KButton
v-if="token === '' || isZoneConnected"
appearance="outline"
data-testid="exit-button"
@click="() => {
if(token === '' || isZoneConnected) {
route.back({
name: 'zone-cp-list-view',
})
} else {
toggleConfirmModal()
}
}"
:to="{ name: 'zone-cp-list-view' }"
>
{{ t('zones.form.exit') }}
</KButton>

<KButton
v-else
appearance="outline"
data-testid="exit-button"
@click="toggleConfirmModal"
>
{{ t('zones.form.exit') }}
</KButton>
Expand Down

0 comments on commit 6a78b62

Please sign in to comment.