Skip to content

Commit

Permalink
feat: min ssg version
Browse files Browse the repository at this point in the history
  • Loading branch information
mwargan committed Mar 20, 2024
1 parent 62aaf6b commit b8b985d
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 11 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -103,4 +103,4 @@
"test:unit:coverage",
"test:visual:ci"
]
}
}
8 changes: 0 additions & 8 deletions src/App.vue
Original file line number Diff line number Diff line change
@@ -1,20 +1,12 @@
<script setup lang="ts">
import PageFooter from "./components/PageFooter.vue";
import NavBar from "./components/NavBar.vue";
import { useUserStore } from "./stores/user";
import { RouterView, useRouter } from "vue-router";
import { ref } from "vue";
import { navIsLoading } from "./router";
// Using the store, attempt to get the current user
const user = useUserStore();
const isReady = ref(false);
if (!user.attemptedToFetchUser) {
user.getUser();
}
const router = useRouter();
router.isReady().then(() => {
Expand Down
7 changes: 7 additions & 0 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import { metaTagPlugin } from "@m-media/vue3-meta-tags";
import { EventsPlugin } from "./eventBus/events";
import { ViteSSG } from "vite-ssg";
import { allRoutes, navIsLoading } from "./router";
import { useUserStore } from "./stores/user";

// `export const createApp` is required instead of the original `createApp(App).mount('#app')`
export const createApp = ViteSSG(
Expand Down Expand Up @@ -75,6 +76,12 @@ export const createApp = ViteSSG(
);

app.use(EventsPlugin);

const user = useUserStore(pinia);

if (!user.attemptedToFetchUser) {
user.getUser();
}
}
);

Expand Down
4 changes: 2 additions & 2 deletions vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ export default defineConfig({
},
ssgOptions: {
mock: true,
// find all routes in the src/pages directory
script: "async",

dirStyle: "nested",
},
resolve: {
alias: {
Expand Down

0 comments on commit b8b985d

Please sign in to comment.