2021-07-10 04:38:42 +12:00
|
|
|
<template>
|
|
|
|
<router-view />
|
|
|
|
</template>
|
2023-08-19 20:43:21 +12:00
|
|
|
|
2021-07-10 04:38:42 +12:00
|
|
|
<script lang="ts">
|
|
|
|
import { defineComponent } from 'vue'
|
2023-09-09 09:54:44 +12:00
|
|
|
import { useRouter } from 'vue-router'
|
2021-07-10 04:38:42 +12:00
|
|
|
|
|
|
|
export default defineComponent({
|
2023-09-09 09:54:44 +12:00
|
|
|
name: 'App',
|
|
|
|
/**
|
|
|
|
* Setup is used to determine if the app is running testing of some kind or in normal mode
|
|
|
|
*/
|
|
|
|
setup () {
|
|
|
|
/**
|
|
|
|
* Local router variable
|
|
|
|
*/
|
|
|
|
const router = useRouter()
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Testing type currently possibly happening
|
|
|
|
* */
|
|
|
|
const testingType = window.extraEnvVariables.TEST_ENV
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Name of the component being possibly tested via component testing
|
|
|
|
* */
|
|
|
|
const testingComponentName = window.extraEnvVariables.COMPONENT_NAME
|
|
|
|
|
|
|
|
/**
|
|
|
|
* In case of some testing happening:
|
|
|
|
* Reroute to the proper component path route assuming all is properly set.
|
|
|
|
* Otherwise, make sure we are on homepage on load.
|
|
|
|
*/
|
|
|
|
if (testingType && testingType === 'components' && testingComponentName) {
|
|
|
|
router.push({ path: `/componentTesting/${testingComponentName}` })
|
|
|
|
} else {
|
|
|
|
router.push({ path: '/' })
|
|
|
|
}
|
|
|
|
}
|
2021-07-10 04:38:42 +12:00
|
|
|
})
|
|
|
|
</script>
|