55
66<script setup lang="ts">
77import { ref } from ' vue'
8+ import { useRoute } from ' vue-router'
89import debounce from ' lodash/debounce'
910import { showSuccess , showError } from ' @nextcloud/dialogs'
1011import { t } from ' @nextcloud/l10n'
@@ -16,6 +17,9 @@ import { ValidatorAPI } from '../../Api'
1617import { StatusResults } from ' ../../Types'
1718import { useSessionStore } from ' ../../stores/session'
1819
20+ const route = useRoute ()
21+ const sessionStore = useSessionStore ()
22+
1923type InputProps = {
2024 success: boolean
2125 error: boolean
@@ -24,8 +28,6 @@ type InputProps = {
2428 label: string
2529}
2630
27- const sessionStore = useSessionStore ()
28-
2931const inputProps = ref <InputProps >({
3032 success: false ,
3133 error: false ,
@@ -59,7 +61,7 @@ const validatePublicUsername = debounce(async function () {
5961
6062 try {
6163 await ValidatorAPI .validateName (
62- sessionStore .route . params . token ,
64+ sessionStore .publicToken ,
6365 sessionStore .share .user .displayName ,
6466 )
6567 setStatus (' success' )
@@ -87,7 +89,7 @@ async function submit() {
8789
8890<template >
8991 <NcActionInput
90- v-if =" sessionStore . route .name === ' publicVote ' "
92+ v-if =" route .meta . publicVotePage "
9193 v-bind =" inputProps "
9294 v-model =" sessionStore .share .user .displayName "
9395 @update :value =" validatePublicUsername "
0 commit comments