fix(projects): fetch projects directly instead of using useAsyncData
This commit is contained in:
@@ -31,24 +31,23 @@ export const useProjectsStore = defineStore("projects", {
|
|||||||
async loadProjects() {
|
async loadProjects() {
|
||||||
this.loading = true;
|
this.loading = true;
|
||||||
|
|
||||||
const { data: projects } = await useAsyncData("projects", () =>
|
const projects = await queryCollection("projects")
|
||||||
queryCollection("projects")
|
.order("order", "ASC")
|
||||||
.order("order", "ASC")
|
.select(
|
||||||
.select(
|
"id",
|
||||||
"id",
|
"order",
|
||||||
"order",
|
"scope",
|
||||||
"scope",
|
"title",
|
||||||
"title",
|
"link",
|
||||||
"link",
|
"description",
|
||||||
"description",
|
"summary",
|
||||||
"summary",
|
"technologies",
|
||||||
"technologies",
|
"tasks",
|
||||||
"tasks",
|
)
|
||||||
)
|
.all();
|
||||||
.all(),
|
|
||||||
);
|
if (!projects) throw "Cannot load projects";
|
||||||
if (!projects.value) throw "Cannot load projects";
|
this.projects = projects.map((project) => ({
|
||||||
this.projects = projects.value.map((project) => ({
|
|
||||||
...project,
|
...project,
|
||||||
id: project.id
|
id: project.id
|
||||||
.split("/")[2]!
|
.split("/")[2]!
|
||||||
|
|||||||
Reference in New Issue
Block a user