|
99 | 99 | </template> |
100 | 100 |
|
101 | 101 | <script setup lang="ts"> |
102 | | - import { Head as InertiaHead, usePage } from '@inertiajs/inertia-vue3'; |
103 | | - import { useStore } from '../store'; |
104 | | - import { CdxDialog, CdxButton, CdxIcon, CdxMessage } from "@wikimedia/codex"; |
105 | | - import { cdxIconDie, cdxIconInfo } from '@wikimedia/codex-icons'; |
106 | | - import ItemIdSearchTextarea from '../Components/ItemIdSearchTextarea.vue'; |
107 | | - import { ref, computed } from 'vue'; |
108 | | - import type { Ref } from 'vue'; |
109 | | - import { Inertia } from '@inertiajs/inertia'; |
110 | | -
|
111 | | - interface ErrorMessages { |
112 | | - [ key : string ] : string |
113 | | - } |
| 102 | +import { Head as InertiaHead, usePage } from '@inertiajs/inertia-vue3'; |
| 103 | +import { useStore } from '../store'; |
| 104 | +import { CdxDialog, CdxButton, CdxIcon, CdxMessage } from "@wikimedia/codex"; |
| 105 | +import { cdxIconDie, cdxIconInfo } from '@wikimedia/codex-icons'; |
| 106 | +import ItemIdSearchTextarea from '../Components/ItemIdSearchTextarea.vue'; |
| 107 | +import { ref, computed } from 'vue'; |
| 108 | +import type { Ref } from 'vue'; |
| 109 | +import { Inertia } from '@inertiajs/inertia'; |
| 110 | +
|
| 111 | +interface ErrorMessages { |
| 112 | + [ key : string ] : string |
| 113 | +} |
114 | 114 |
|
115 | | - interface FlashMessages { |
116 | | - errors : { [ key : string ] : string } |
117 | | - } |
| 115 | +interface FlashMessages { |
| 116 | + errors : { [ key : string ] : string } |
| 117 | +} |
118 | 118 |
|
119 | | - const textarea = ref<InstanceType<typeof ItemIdSearchTextarea> | null>(null); |
120 | | - const store = useStore(); |
121 | | - const page = usePage(); |
122 | | - const textareaInputValue: Ref<string> = ref(store.lastSearchedIds); |
| 119 | +const textarea = ref<InstanceType<typeof ItemIdSearchTextarea> | null>(null); |
| 120 | +const store = useStore(); |
| 121 | +const page = usePage(); |
| 122 | +const textareaInputValue: Ref<string> = ref(store.lastSearchedIds); |
| 123 | +const faqDialog = ref(false); |
123 | 124 |
|
124 | | - const faqDialog = ref(false); |
125 | | - const serversideValidationError = computed<boolean>(() => { |
126 | | - const errors = page.props.value.errors as ErrorMessages; |
127 | | - return errors && Object.keys(errors).length > 0; |
128 | | - }); |
| 125 | +const serversideValidationError = computed<boolean>(() => { |
| 126 | + const errors = page.props.value.errors as ErrorMessages; |
| 127 | + return errors && Object.keys(errors).length > 0; |
| 128 | +}); |
129 | 129 |
|
130 | | - const unexpectedError = computed<string>(() => { |
131 | | - const flashMessages = page.props.value.flash as FlashMessages; |
132 | | - return (flashMessages.errors && flashMessages.errors.unexpected); |
133 | | - }); |
| 130 | +const unexpectedError = computed<string>(() => { |
| 131 | + const flashMessages = page.props.value.flash as FlashMessages; |
| 132 | + return (flashMessages.errors && flashMessages.errors.unexpected); |
| 133 | +}); |
134 | 134 |
|
135 | | - const loading = computed<boolean>(() => { |
136 | | - return (store.loading); |
137 | | - }); |
| 135 | +const loading = computed<boolean>(() => { |
| 136 | + return (store.loading); |
| 137 | +}); |
138 | 138 |
|
139 | | - function send(): void{ |
140 | | - (textarea as InstanceType<typeof ItemIdSearchTextarea>).value.validate(); |
| 139 | +function send(): void{ |
| 140 | + (textarea as InstanceType<typeof ItemIdSearchTextarea>).value.validate(); |
141 | 141 |
|
142 | | - if((textarea as InstanceType<typeof ItemIdSearchTextarea>).value.validationError) { |
143 | | - return; |
144 | | - } |
145 | | - store.saveSearchedIds( textareaInputValue.value ); |
146 | | - Inertia.get( '/results', |
147 | | - { ids: (textarea as InstanceType<typeof ItemIdSearchTextarea>).value.serializeInput() } |
148 | | - ); |
| 142 | + if((textarea as InstanceType<typeof ItemIdSearchTextarea>).value.validationError) { |
| 143 | + return; |
149 | 144 | } |
| 145 | + store.saveSearchedIds( textareaInputValue.value ); |
| 146 | + Inertia.get( '/results', |
| 147 | + { ids: (textarea as InstanceType<typeof ItemIdSearchTextarea>).value.serializeInput() } |
| 148 | + ); |
| 149 | +} |
150 | 150 |
|
151 | | - function showRandom(): void{ |
152 | | - Inertia.get( '/random' ); |
153 | | - } |
| 151 | +function showRandom(): void{ |
| 152 | + Inertia.get( '/random' ); |
| 153 | +} |
154 | 154 | </script> |
155 | 155 |
|
156 | 156 | <style lang="scss"> |
|
0 commit comments