vuencoder

1.0.2 • Public • Published

Vue Ncoder: Laravel API Encryption Frontend Package

GitHub issues GitHub forks GitHub stars

Vue Ncoder is a Axios Based Encryption package which encrypts API calls.

This was created to work with Laravel Framework. 

Installation

npm install vuencoder

##Usage

Configuration

plugins/vue-ncoder.js

import {VueNcoder} from 'vuencoder';
import Vue from "vue";

const key = 'your base64 Encryption Key';
const enableEncryption = true;  // Enable Or Disable Encryption

const axiosOptions = {
  baseURL: 'api/',
};

Vue.use(VueNcoder(key, enableEncryption), axiosOptions);

app.js

window.Vue = require('vue');
Vue.config.productionTip = false;

require('~/plugins/vue-ncoder');

const app = new Vue({
  el: '#app',
});

Example

Send Request

ncoder.post('auth/login', this.loginForm).then((response) => {
              // Success
              }).catch((error) => {
              // Error
              });

ncoder.get('auth/user').then((response) => {
              // Success
              }).catch((error) => {
              // Error
              });

Set Headers

ncoder.defaults.headers.common['Authorization'] = `Bearer ${token}`;

Credits

Laravel Package

License

The MIT License (MIT). Please see License File for more information.

Package Sidebar

Install

npm i vuencoder

Weekly Downloads

0

Version

1.0.2

License

MIT

Unpacked Size

17.6 kB

Total Files

10

Last publish

Collaborators

  • avgkudey