@worksafevictoria/wcl7.5 1.1.0-beta.89 → 1.1.0-beta.90

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@worksafevictoria/wcl7.5",
3
- "version": "1.1.0-beta.89",
3
+ "version": "1.1.0-beta.90",
4
4
  "main": "src/index.js",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -51,58 +51,45 @@
51
51
  </template>
52
52
  </hero-header>
53
53
  </template>
54
- <script>
54
+ <script setup>
55
55
  import Search from './../../SubComponents/Search/index.vue'
56
56
  import CtaButton from './../../SubComponents/CtaButton/index.vue'
57
57
  import HeroHeader from './../../Global/HeroHeader/index.vue'
58
58
  import earthIcon from './../../../assets/icons/earth.svg?url'
59
59
 
60
- export default {
61
- name: 'HomepageHeader',
62
- components: {
63
- Search,
64
- CtaButton,
65
- HeroHeader,
60
+ const props = defineProps({
61
+ contentParser: {
62
+ type: Function,
63
+ required: true,
66
64
  },
67
- props: {
68
- contentParser: {
69
- type: Function,
70
- required: true,
71
- },
72
- heroHeader: {
73
- type: Object,
74
- required: true,
75
- },
76
- fetchMenu: {
77
- type: Function,
78
- required: true,
79
- },
65
+ heroHeader: {
66
+ type: Object,
67
+ required: true,
80
68
  },
81
- // TODO useAsyncData <script setup>
82
- // async fetch() {
83
- // console.log("NEVA")
84
- // await this.renderMenu()
85
- // },
86
- // Temp use of mounted to replace fetch
87
- async mounted() {
88
- await this.renderMenu()
69
+ fetchMenu: {
70
+ type: Function,
71
+ required: true,
89
72
  },
73
+ })
90
74
 
91
- data: () => ({
92
- links: [],
93
- earthIcon,
94
- }),
95
- methods: {
96
- async renderMenu() {
97
- const menu = await this.fetchMenu()
98
- this.links = (Array.isArray(menu) ? menu : []).map((item) => {
99
- return {
100
- text: item.title,
101
- path: item.relative || item.absolute,
102
- }
103
- })
104
- },
105
- },
75
+ const links = ref([])
76
+
77
+ await useAsyncData('fetchData', async () => {
78
+ try {
79
+ await renderMenu()
80
+ } catch (err) {
81
+ console.log('🚀 ~ err:', err)
82
+ }
83
+ })
84
+
85
+ async function renderMenu() {
86
+ const menu = await props.fetchMenu()
87
+ links.value = (Array.isArray(menu) ? menu : []).map((item) => {
88
+ return {
89
+ text: item.title,
90
+ path: item.relative || item.absolute,
91
+ }
92
+ })
106
93
  }
107
94
  </script>
108
95
  <style lang="scss" scoped>