New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

vue-contentful-hook

Package Overview
Dependencies
Maintainers
0
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

vue-contentful-hook

A vue hook to fetch contentful data using GraphQL query

  • 1.5.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
5
Maintainers
0
Weekly downloads
 
Created
Source

Vue Contentful Hook

A hook to call the contentful API using GraphQl

Usage

Ideally you should pass env variables as token and spaceId

export interface Dummy<T, U> {
  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<Dummy<string, number>>(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);

Lucien Bénié

💻 📖

This project follows the all-contributors specification. Contributions of any kind welcome!

Keywords

FAQs

Package last updated on 25 Sep 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc