Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/lbenie/vue-contentful-hook
A vue hook to be used with contentful
https://github.com/lbenie/vue-contentful-hook
Last synced: 26 days ago
JSON representation
A vue hook to be used with contentful
- Host: GitHub
- URL: https://github.com/lbenie/vue-contentful-hook
- Owner: lbenie
- License: mit
- Created: 2021-12-22T19:28:14.000Z (about 3 years ago)
- Default Branch: main
- Last Pushed: 2024-10-29T18:08:22.000Z (3 months ago)
- Last Synced: 2024-10-29T20:12:29.685Z (3 months ago)
- Language: JavaScript
- Size: 2.7 MB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Funding: .github/funding.yml
- License: LICENSE
Awesome Lists containing this project
README
# Vue Contentful Hook
A hook to call the contentful API using GraphQl
## Usage
Ideally you should pass env variables as token and spaceId
```ts
export interface Dummy {
readonly dummyCollection: {
readonly total: number;
readonly skip: number;
readonly limit: number;
readonly items: readonly T[];
};readonly someOtherDummyCollection: {
readonly total: number;
readonly skip: number;
readonly limit: number;
readonly items: readonly U[];
};
}const query = `
{
dummyCollection {
items {
name
}
}
someOtherDummyCollection {
items {
name
}
}
}
`;
const { data } = useContentful>(query, {
token: "myToken",
spaceId: "mySpaceId",
});// an array of strings
console.log("data", data.value?.dummyCollection.items);
// an array of numbers
console.log("data", data.value?.dummyCollection.items);
```This project follows the [all-contributors](https://github.com/all-contributors/all-contributors) specification. Contributions of any kind welcome!