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
1
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.3.1
Source
npm
Version published
Weekly downloads
1
Maintainers
1
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

vue

FAQs

Package last updated on 30 Mar 2022

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