项目作者: madhusudhan1234

项目描述 :
:tada: Call the ajax method using axios :christmas_tree:, axios header are set
高级语言: JavaScript
项目地址: git://github.com/madhusudhan1234/callclient.git
创建时间: 2018-02-05T19:31:31Z
项目社区:https://github.com/madhusudhan1234/callclient

开源协议:

下载


In this package I just added the axios header

  • This package is helpful for ajax call
  • It is very useful for the SPA application like laravel and Vue Js

How to set up ?

  • In the main blade file of laravel we can set the csrf token like this way in meta tag
  1. ......
  2. <meta name="csrf-token" content="csrf-token-here">
  3. ......
  • Install npm package using $ npm i callclient --save

How to use ?

  • import in file import { callClient} from 'callclient';

    1. callClient.get(url, params = {})
    2. .then((response) => {
    3. const values = response.data;
    4. })
    5. .catch(() => {
    6. console.log('Hey Error aayo yar');
    7. });
  • For the multipartAjax we can do like this

    1. import { callMultiPartAjax } from 'callclient';
    2. callMultiPartAjax.get(url, payload)
    3. .then((response) => {
    4. console.log('working cool');
    5. })
    6. .catch(() => {
    7. console.log('Hey Error aayo yar');
    8. });