This package has been deprecated

Author message:

Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.

gatsby-theme-headless-wordpress-admin

0.0.11 • Public • Published

Gatsby Wordpress Admin

What does it do?

Adds WP cookie authentication to your WP Gatsby site to keep you authenticated in WP and your frontend at the same time. Automatically creates a /login and /dashboard page to manage your content.

You can also import the custom useAuth hook anywhere in your application. It will return your user.

Getting Started

  1. yarn add gatsby-theme-headless-wordpress-admin

Required WP plugins

useAuth

Example usage

import { useAuth } from "gatsby-theme-headless-wordpress-admin";

const { auth } = useAuth();

useLogin

Example usage

import { useLogin } from "gatsby-theme-headless-wordpress-admin";

const [sendUserLogin, { data, error, loading, called }] = useLogin({
  onCompleted: (data) => {
    console.log({ data });
  },
  onError: (err) => {
    console.log({ err });
  },
});

<button
  onClick={() =>
    sendUserLogin({
      variables: { username: "your_username", password: "your_password" },
    })
  }
/>;

Package Sidebar

Install

npm i gatsby-theme-headless-wordpress-admin

Weekly Downloads

0

Version

0.0.11

License

MIT

Unpacked Size

96.3 kB

Total Files

75

Last publish

Collaborators

  • calebbarnes