125125 </v-card >
126126 </v-dialog >
127127 </div >
128- <Snackbar
129- :open-snackbar =" openSnackbar"
130- :message =" snackbarMessage"
131- :duration =" 3000"
132- :close-button =" false"
133- @update:open-snackbar =" openSnackbar = $event"
134- />
135128</template >
136129
137130<script setup lang="ts">
138131import { useWindowSize } from ' @vueuse/core'
139132import { computed , defineProps , onBeforeMount , onBeforeUnmount , ref , toRefs , watch } from ' vue'
140133
141134import { defaultBlueOsAddress } from ' @/assets/defaults'
142- import Snackbar from ' @/components/Snackbar.vue '
135+ import { openSnackbar } from ' @/composables/snackbar '
143136import { getDataLakeVariableData , listenDataLakeVariable , unlistenDataLakeVariable } from ' @/libs/actions/data-lake'
144137import { isValidURL } from ' @/libs/utils'
145138import { useAppInterfaceStore } from ' @/stores/appInterface'
@@ -162,8 +155,6 @@ const widget = toRefs(props).widget
162155const iframe_loaded = ref (false )
163156const transparency = ref (0 )
164157const inputURL = ref (widget .value .options .source )
165- const openSnackbar = ref (false )
166- const snackbarMessage = ref (' ' )
167158const isWrapped = ref (false )
168159const vehicleAddressFromDataLake = ref <string >(' ' )
169160
@@ -209,13 +200,11 @@ const validateURL = (url: string): true | string => {
209200const updateURL = (): void => {
210201 const urlValidationResult = validateURL (composedURL (inputURL .value , widget .value .options .useVehicleAddressAsBase ))
211202 if (urlValidationResult !== true ) {
212- snackbarMessage .value = ` ${urlValidationResult } Please enter a valid URL. `
213- openSnackbar .value = true
203+ openSnackbar ({ message: ` ${urlValidationResult } Please enter a valid URL. ` , variant: ' error' })
214204 return
215205 }
216206 widget .value .options .source = inputURL .value
217- snackbarMessage .value = ` IFrame URL sucessfully updated to '${toBeUsedURL .value }'. `
218- openSnackbar .value = true
207+ openSnackbar ({ message: ` IFrame URL sucessfully updated to '${toBeUsedURL .value }'. ` , variant: ' success' })
219208}
220209
221210const apiEventCallback = (event : MessageEvent ): void => {
0 commit comments