Skip to content

Commit 47d9bc9

Browse files
iframe: Fix snackbar usage
1 parent b13e4f7 commit 47d9bc9

File tree

1 file changed

+3
-14
lines changed

1 file changed

+3
-14
lines changed

src/components/widgets/IFrame.vue

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -125,21 +125,14 @@
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">
138131
import { useWindowSize } from '@vueuse/core'
139132
import { computed, defineProps, onBeforeMount, onBeforeUnmount, ref, toRefs, watch } from 'vue'
140133
141134
import { defaultBlueOsAddress } from '@/assets/defaults'
142-
import Snackbar from '@/components/Snackbar.vue'
135+
import { openSnackbar } from '@/composables/snackbar'
143136
import { getDataLakeVariableData, listenDataLakeVariable, unlistenDataLakeVariable } from '@/libs/actions/data-lake'
144137
import { isValidURL } from '@/libs/utils'
145138
import { useAppInterfaceStore } from '@/stores/appInterface'
@@ -162,8 +155,6 @@ const widget = toRefs(props).widget
162155
const iframe_loaded = ref(false)
163156
const transparency = ref(0)
164157
const inputURL = ref(widget.value.options.source)
165-
const openSnackbar = ref(false)
166-
const snackbarMessage = ref('')
167158
const isWrapped = ref(false)
168159
const vehicleAddressFromDataLake = ref<string>('')
169160
@@ -209,13 +200,11 @@ const validateURL = (url: string): true | string => {
209200
const 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
221210
const apiEventCallback = (event: MessageEvent): void => {

0 commit comments

Comments
 (0)