@badaso/nuxt

1.0.0 • Public • Published

@badaso/nuxt

Nuxt module for integration with badaso out of the box.

Features

  • RESTful methods
  • Handle errors with hooks

Installation

Using npm:

npm install @badaso/nuxt

Using yarn:

yarn add @badaso/nuxt

Configure

Add @badaso/nuxt to the modules section of nuxt.config.js:

export default {
  modules: ['@badaso/nuxt'],
  badaso: {
    // Options
  }
}

Options

  • endpoint Default: process.env.BADASO_URL || 'http://localhost:8000' URL of the Badaso server. Environtment variable BADASO_URL can be used to override endpoint.
  • entities Default: {} You can specify the entities that present in your API. For example:
    export default {
      badaso: {
        entities: {
          post: true,
          crud: ['articles', 'products']
        }
      }
    }
    Then you can use this.$badaso.$post.browse() in your application. For now, entities only accept:
    • post: Boolean
    • content: Boolean
    • crud: Array
  • key Key used for the cookie name as well as localStorage/sessionStorage key.
  • prefix Default: badaso-api URL prefix to access Badaso API server.

Usage

Authentication

To handle authentication in your Nuxt app with Badaso, you can:

Login

await this.$badaso.login({ email: '', password: '' })

Register

await this.$badaso.register({ email: '', name: '', password: '', passwordConfirmation: '' })

Verify

await this.$badaso.verify({ email: '', token: '' })

Resend Email Verification

await this.$badaso.sendEmailConfirmation({ email: '' })

Logout

await this.$badaso.logout()

Forgot Password

await this.$badaso.forgotPassword({ email: '' })

Verify Token for Forgot Password

await this.$badaso.verifyForgotPasswordToken({ email: '', token: '' })

Reset Password

await this.$badaso.resetPassword({ email: '', password: '', token: '' })

User

Once logged in, you can access your user everywhere:

this.$badaso.user

Post Module

Content Module

For content module, please refer to this page

CRUD Generated

For CRUD generated, please refer to this page

Development

  1. Clone this repo
  2. Install dependencies using npm install or yarn install
  3. Start development server using npm run dev or yarn dev

Readme

Keywords

none

Package Sidebar

Install

npm i @badaso/nuxt

Weekly Downloads

3

Version

1.0.0

License

SEE LICENSE IN LICENSE

Unpacked Size

15.9 kB

Total Files

8

Last publish

Collaborators

  • rizkiheryandi