-
+
+
+
![]()
diff --git a/src/entry-client.js b/src/entry-client.js
index 8672587..138948d 100644
--- a/src/entry-client.js
+++ b/src/entry-client.js
@@ -1,10 +1,17 @@
import { createApp } from './main'
import { registerOnlyClientComponents } from '@/components/clientComponents'
import { registerGlobalComponents } from './components/globalComponents'
-const { app, router } = createApp()
+
+const { app, router, store } = createApp()
+const storeInitialState = window.initialState
+
+if (storeInitialState) {
+ store.state.value = storeInitialState
+}
+
+registerOnlyClientComponents(app)
+registerGlobalComponents(app)
router.isReady().then(() => {
- registerOnlyClientComponents(app)
- registerGlobalComponents(app)
app.mount('#app')
})
diff --git a/src/entry-server.js b/src/entry-server.js
index 4a2f30b..62deae2 100644
--- a/src/entry-server.js
+++ b/src/entry-server.js
@@ -2,9 +2,10 @@ import { basename } from 'node:path'
import { renderToString } from 'vue/server-renderer'
import { createApp } from './main'
import { registerGlobalComponents } from '@/components/globalComponents'
+import devalue from '@nuxt/devalue'
export async function render(url, manifest) {
- const { app, router } = createApp()
+ const { app, router, store } = createApp()
registerGlobalComponents(app)
// set the router to the desired URL before rendering
@@ -18,11 +19,16 @@ export async function render(url, manifest) {
const ctx = {}
const html = await renderToString(app, ctx)
+ const renderState = `
+ `
+
// the SSR manifest generated by Vite contains module -> chunk/asset mapping
// which we can then use to determine what files need to be preloaded for this
// request.
const preloadLinks = renderPreloadLinks(ctx.modules, manifest)
- return [html, preloadLinks]
+ return [html, renderState, preloadLinks]
}
function renderPreloadLinks(modules, manifest) {
diff --git a/src/main.js b/src/main.js
index ee4c315..9a57434 100644
--- a/src/main.js
+++ b/src/main.js
@@ -23,18 +23,21 @@ const app = initTaxonPagesApp()
app.mount('#app')
*/
-import.meta.globEager('@/assets/css/main.css')
-import.meta.globEager('../config/style/*.{scss,css}')
+import.meta.glob('@/assets/css/main.css', { eager: true })
+import.meta.glob('../config/style/*.{scss,css}', { eager: true })
-import { createSSRApp } from 'vue'
import App from './App.vue'
+import { createPinia } from 'pinia'
+import { createSSRApp } from 'vue'
import { createRouter } from './router'
export function createApp() {
const app = createSSRApp(App)
const router = createRouter()
+ const store = createPinia()
app.use(router)
+ app.use(store)
- return { app, router }
+ return { app, router, store }
}
diff --git a/src/modules/otus/components/Panel/PanelGallery/Gallery.vue b/src/modules/otus/components/Panel/PanelGallery/Gallery.vue
index 85f29aa..ac2d77c 100644
--- a/src/modules/otus/components/Panel/PanelGallery/Gallery.vue
+++ b/src/modules/otus/components/Panel/PanelGallery/Gallery.vue
@@ -7,8 +7,8 @@
diff --git a/src/modules/otus/components/Panel/PanelMap/PanelMap.vue b/src/modules/otus/components/Panel/PanelMap/PanelMap.vue
index 4057b92..e2239ad 100644
--- a/src/modules/otus/components/Panel/PanelMap/PanelMap.vue
+++ b/src/modules/otus/components/Panel/PanelMap/PanelMap.vue
@@ -3,8 +3,6 @@
-
-
(isLoading = false)"
/>
-
-
- (isOtuSearchVisible = false)"
- />
-
+ (isOtuSearchVisible = false)"
+ />
{
+ return {
+ otu: null,
+ taxon: null,
+ images: null
+ }
+ },
+ actions: {
+ async loadTaxon(id) {
+ const taxon = await TaxonWorks.summary(id)
+
+ this.taxon = taxon.data
+ },
+ async loadOtu(id) {
+ const otu = await TaxonWorks.getOtu(id)
+
+ this.otu = otu.data
+ },
+
+ async loadInit(otuId) {
+ const otu = (await TaxonWorks.getOtu(otuId)).data
+ const taxon = (await TaxonWorks.summary(otu.taxon_name_id)).data
+
+ this.otu = otu
+ this.taxon = taxon
+ },
+
+ async loadImages(otuId) {
+ const params = {
+ extend: ['depictions', 'attribution', 'source', 'citations'],
+ otu_scope: ['all']
+ }
+
+ this.images = (await TaxonWorks.getOtuImages(otuId, params)).data
+ }
+ },
+})
\ No newline at end of file
diff --git a/src/modules/otus/views/Index.vue b/src/modules/otus/views/Index.vue
index 03cc10d..11bd899 100644
--- a/src/modules/otus/views/Index.vue
+++ b/src/modules/otus/views/Index.vue
@@ -6,8 +6,9 @@
class="flex flex-col-reverse md:flex-row justify-between items-start"
>
@@ -45,7 +47,7 @@