Skip to content

Instantly share code, notes, and snippets.

@samwolf1982
Created June 5, 2023 13:44
Show Gist options
  • Select an option

  • Save samwolf1982/918bd564e9c7ca7e5dd247cd4e2594d3 to your computer and use it in GitHub Desktop.

Select an option

Save samwolf1982/918bd564e9c7ca7e5dd247cd4e2594d3 to your computer and use it in GitHub Desktop.
<script setup>
import {onMounted, ref} from "vue";
import {useQuasar} from "quasar";
import Notify from "@/components/UI/Notify.vue";
import {useApi} from "@/api/Api";
import {useState} from "@/hooks/useState";
import {computed} from "vue";
import {useStore} from "vuex";
import * as types from "@/store/actionTypes/actionTypes";
const store = useStore();
const vocabulary = computed(() => store.state.vocabulary);
const someStoreItem = computed(() => store.state.someStoreItem);
const [loading, setLoading] = useState();
const [notifyModel, setNotifyModel] = useState()
const $q = useQuasar();
const api = useApi();
onMounted(() => {
setLoading(true)
api.someApiMethod()
.then(response => response.data.result)
.then(result => {
setLoading(false)
setNotifyModel('Some Message')
});
api.someApiMethod().then(response => response.data.result).then(result => {
const {cmThemeSettings2} = result
store.dispatch(types.CM_THEME_SETTINGS_UPDATE_, cmThemeSettings2);
store.dispatch(types.ADD_RESET_DATA, {cmThemeSettings2: {...reset.value, cmThemeSettings2}});
})
});
</script>
<template>
<Notify :model="notifyModel"/>
</template>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment