Skip to content

Commit fcc2029

Browse files
committed
useAsyncState
1 parent 5518a03 commit fcc2029

File tree

1 file changed

+8
-10
lines changed
  • openc3-cosmos-init/plugins/packages/openc3-vue-common/src/tools/scriptrunner

1 file changed

+8
-10
lines changed

openc3-cosmos-init/plugins/packages/openc3-vue-common/src/tools/scriptrunner/RunningScripts.vue

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -210,6 +210,7 @@
210210

211211
<script setup>
212212
import { ref, watch, onMounted, onBeforeUnmount, inject } from 'vue'
213+
import { useAsyncState } from '@vueuse/core'
213214
import { useRouter } from 'vue-router'
214215
import { Api, OpenC3Api } from '@openc3/js-common/services'
215216
import { OutputDialog } from '@/components'
@@ -235,7 +236,13 @@ const dialog = inject('dialog')
235236
const { formatDateTimeHMS } = TimeFilters.methods
236237
237238
const api = new OpenC3Api()
238-
const timeZone = ref('local')
239+
const { state: timeZone } = useAsyncState(
240+
api
241+
.get_setting('time_zone')
242+
.then((response) => response)
243+
.catch(() => {}),
244+
'local',
245+
)
239246
const activeTab = ref('completed')
240247
const downloadScript = ref(null)
241248
const refreshTimer = ref(null)
@@ -310,15 +317,6 @@ watch(activeTab, (newTab) => {
310317
})
311318
312319
onMounted(async () => {
313-
try {
314-
const response = await api.get_setting('time_zone')
315-
if (response) {
316-
timeZone.value = response
317-
}
318-
} catch (error) {
319-
// Do nothing
320-
}
321-
322320
getRunningScripts()
323321
getCompletedScripts()
324322

0 commit comments

Comments
 (0)