All files / src app.vue

91.66% Statements 22/24
53.84% Branches 7/13
50% Functions 1/2
90.47% Lines 19/21

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56              1x 1x 1x 1x 1x 1x 1x   11x 11x 11x   11x                 11x 11x   11x 2x         2x       9x 2x   2x                      
<template>
  <NotificationContainer />
  <AppLayout />
  <DevEnvSwitcher />
</template>
 
<script setup>
import { onErrorCaptured, onMounted } from 'vue';
import { useRoute, useRouter } from 'vue-router';
import { useStore } from 'vuex';
import DevEnvSwitcher from './components/DevEnvSwitcher';
import NotificationContainer from './components/NotificationContainer';
import AppLayout from './layouts/AppLayout';
import { NOTIF_FQ } from './store/types';
 
const store = useStore();
const route = useRoute();
const router = useRouter();
 
onErrorCaptured((err) => {
  store.dispatch(NOTIF_FQ.actions.showError, {
    message: err?.message || 'An unexpected error occurred',
    type: 'component_error',
    closable: true,
  });
  return false;
});
 
onMounted(() => {
  const { error, message, success } = route.query;
 
  if (error && message) {
    store.dispatch(NOTIF_FQ.actions.showError, {
      message: decodeURIComponent(message),
      type: error,
    });
 
    router.replace({
      path: route.path,
      query: {},
    });
  } else if (success && message) {
    store.dispatch(NOTIF_FQ.actions.showSuccess, decodeURIComponent(message));
 
    router.replace({
      path: route.path,
      query: {},
    });
  }
});
</script>
 
<style lang="scss">
@import '~appSCSS';
</style>