Start connecting nuxt and strapi

This commit is contained in:
Benjamin Bädorf 2022-12-12 14:57:45 +01:00
parent f1ff6f75ad
commit b4eeb244bf
No known key found for this signature in database
GPG key ID: 4406E80E13CD656C
12 changed files with 2368 additions and 77 deletions

View file

@ -0,0 +1,26 @@
{
"kind": "collectionType",
"collectionName": "pages",
"info": {
"singularName": "page",
"pluralName": "pages",
"displayName": "Page"
},
"options": {
"draftAndPublish": true
},
"pluginOptions": {},
"attributes": {
"Title": {
"type": "string"
},
"block": {
"type": "json"
},
"public": {
"type": "boolean",
"default": true,
"required": false
}
}
}

View file

@ -0,0 +1,7 @@
/**
* page controller
*/
import { factories } from '@strapi/strapi'
export default factories.createCoreController('api::page.page');

View file

@ -0,0 +1,7 @@
/**
* page router
*/
import { factories } from '@strapi/strapi';
export default factories.createCoreRouter('api::page.page');

View file

@ -0,0 +1,7 @@
/**
* page service
*/
import { factories } from '@strapi/strapi';
export default factories.createCoreService('api::page.page');

View file

@ -0,0 +1,10 @@
import { defineComponent } from 'vue';
import { NuxtPage } from '#components';
export default defineComponent({
setup() {
return () => (
<NuxtPage />
);
},
});

View file

@ -1,5 +0,0 @@
<template>
<div>
<NuxtWelcome />
</div>
</template>

View file

@ -2,4 +2,10 @@ import { defineNuxtConfig } from 'nuxt/config';
export default defineNuxtConfig({
modules: ['nuxt-graphql-client'],
runtimeConfig: {
public: {
GQL_HOST: 'http://localhost:1337/graphql' // overwritten by process.env.GQL_HOST
},
},
});

File diff suppressed because it is too large Load diff

View file

@ -13,6 +13,13 @@
"nuxt": "3.0.0"
},
"dependencies": {
"@graphql-codegen/cli": "^2.16.1",
"@schlechtenburg/core": "^0.0.0",
"@schlechtenburg/heading": "^0.0.0",
"@schlechtenburg/image": "^0.0.0",
"@schlechtenburg/layout": "^0.0.0",
"@schlechtenburg/paragraph": "^0.0.0",
"event-target-polyfill": "^0.0.3",
"nuxt-graphql-client": "^0.2.23"
}
}

View file

@ -0,0 +1,21 @@
import { defineComponent } from 'vue';
import {
IBlockData,
SbMain,
} from '@schlechtenburg/core';
export default defineComponent({
setup() {
const route = useRoute();
const path = route.path;
console.log(path);
return () => (
<div class="sb-main-menu">
Path {path}
{/*<SbMain block={props.block} />*/}
</div>
);
},
});

View file

@ -0,0 +1,19 @@
import {
defineComponent,
PropType,
} from 'vue';
import {
IBlockData,
SbMain,
} from '@schlechtenburg/core';
export default defineComponent({
setup() {
return () => (
<div class="sb-main-menu">
Homepage
{/*<SbMain block={props.block} />*/}
</div>
);
},
});

View file

@ -0,0 +1,7 @@
query launches($limit: Int = 5) {
launches(limit: $limit) {
id
launch_year
mission_name
}
}