refactor: flatten components
This commit is contained in:
parent
5813c29448
commit
76d2752479
|
|
@ -5,7 +5,7 @@
|
|||
"scripts": {
|
||||
"dev": "vite",
|
||||
"build": "vite build",
|
||||
"lint": "eslint --ext .ts,.vue \"{src,cypress/integration}/**\"",
|
||||
"lint": "eslint --ext .ts,.vue,.js \"{src,cypress/integration}/**\"",
|
||||
"test:unit": "jest",
|
||||
"test:e2e": "cypress run",
|
||||
"test": "yarn tsc && yarn lint && yarn test:unit && yarn test:e2e"
|
||||
|
|
|
|||
|
|
@ -6,8 +6,8 @@
|
|||
|
||||
<script lang="ts">
|
||||
import { defineComponent } from 'vue'
|
||||
import AppFooter from './components/layout/Footer/index.vue'
|
||||
import AppNavigation from './components/layout/Navigation/index.vue'
|
||||
import AppFooter from './components/Footer.vue'
|
||||
import AppNavigation from './components/Navigation.vue'
|
||||
|
||||
export default defineComponent({
|
||||
name: 'App',
|
||||
|
|
|
|||
|
|
@ -38,14 +38,14 @@
|
|||
<script lang="ts">
|
||||
import { defineComponent, ref } from 'vue'
|
||||
|
||||
import useLinks from './links'
|
||||
import { useNavigationLinks } from './NavigationHooks'
|
||||
|
||||
export default defineComponent({
|
||||
name: 'AppNavigation',
|
||||
setup () {
|
||||
const isUserAuthorized = ref(false)
|
||||
|
||||
const { navLinks } = useLinks({ isUserAuthorized })
|
||||
const { navLinks } = useNavigationLinks({ isUserAuthorized })
|
||||
|
||||
return {
|
||||
isUserAuthorized,
|
||||
|
|
@ -11,7 +11,7 @@ interface NavLink {
|
|||
display: 'all' | 'anonym' | 'authorized'
|
||||
}
|
||||
|
||||
export default function useLinks ({ isUserAuthorized }: UseLinksProps) {
|
||||
export function useNavigationLinks ({ isUserAuthorized }: UseLinksProps) {
|
||||
const displayStatus = computed(() => isUserAuthorized.value ? 'anonym' : 'authorized')
|
||||
|
||||
const allNavLinks: NavLink[] = [
|
||||
Loading…
Reference in New Issue