0.2.6 • Published 2 years ago

wa-auth v0.2.6

Weekly downloads
8
License
ISC
Repository
-
Last release
2 years ago

Package wa-auth

What does this package do? 1. check is Login 2. set user and check Auth in Vue.prototype.$auth.user and Vue.prototype.$auth.check - use in Component => $auth or this.$auth 3. set Token in Header Axios 4. write api Login, Register, Logout, Forgot Password

Prerequisites

  • use package we-axios. OR
  • set axios in Vue.prototype.$axios

##install

npm install wa-auth

##Usage

use in main:

import Auth from 'wa-auth'
Vue.use(Auth, options);

defult Options:

const options = {
    api: {
            login: 'v1/login',
            logout: 'v1/logout',
            register: 'v1/register',
            verify_register: 'v1/verify-register',
            forgot_pass: 'v1/forgot-password',
            verify_forgot_pass: 'v1/verify-forgot-password',
            reset_pass: 'v1/reset-password',
    }
};

###Check Login OR Get User

import Auth from 'wa-auth'
// check Login
Auth.isLogin
//Get User 
Auth.getUser

OR

use $auth.check and $auth.user in Component

###Login:

import {login} from 'wa-auth'
login(requestData, redirect);

redirect is string requestData is object if redirect == null Then Not Redirect

###Logout:

import {logout} from 'wa-auth' 
logout(redirect);

OR use in components:

$_logout(redirect);

redirect is string if redirect == null Then Not Redirect

###Register:

import {register} from 'wa-auth' 
register(requestData);

requestData is object

import {verify_register} from 'wa-auth'
verify_register(requestData, redirect);

redirect is string requestData is object if redirect == null Then Not Redirect

###Forgot Password:

import {forgot_pass} from 'wa-auth' 
forgot_pass(requestData);

requestData is object

import {verify_forgot_pass} from 'wa-auth' 
verify_forgot_pass(requestData);

requestData is object

###Reset Password:

import {reset_pass} from 'wa-auth' 
reset_pass(requestData, redirect);

redirect is string requestData is object

if redirect == null Then Not Redirect

##$emit: has $emit login and logout use:

Vue._instance.$on('login', function () {
    //code
});

Vue._instance.$on('logout', function () {
    //code
});
0.2.6

2 years ago

0.2.3

2 years ago

0.2.5

2 years ago

0.2.4

2 years ago

0.2.2

4 years ago

0.2.1

4 years ago

0.1.0

4 years ago

0.2.0

4 years ago

0.0.3

4 years ago

0.0.2

4 years ago

0.0.1

4 years ago

1.0.0

6 years ago