šŸš€ Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more →
Socket
Sign inDemoInstall
Socket

@vue-composable/axios

Package Overview
Dependencies
Maintainers
1
Versions
74
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@vue-composable/axios

@vue-composable/axios

1.0.0-beta.24
latest
Source
npm
Version published
Weekly downloads
293
2.81%
Maintainers
1
Weekly downloads
Ā 
Created
Source

@vue-composable/axios

vue-composable logo

npm version

bundle size

Introduction

Use Axios library with the composition-api

Vue 3

Vue3 aka vue-next is fully supported

Installing

# @vue/composition-api

# install with yarn
yarn add @vue/composition-api @vue-composable/axios

# install with npm
npm install @vue/composition-api @vue-composable/axios


# vue-next / vue@3.0.0

# install with yarn
yarn add @vue-composable/axios

# install with npm
npm install @vue-composable/axios

Documentation

Check our documentation

<template>
  <div>
    <p>current Id {{ id }}</p>
    <p>
      <button @click="id--">prev</button>
      <button @click="id++">next</button>
    </p>
    <p v-if="loading">loading...</p>
    <div v-else>
      <p>Status: {{ status }}</p>
      {{ data }}
    </div>
  </div>
</template>

<script>
import { ref, watch } from "@vue/runtime-core";
import { useAxios } from "@vue-composable/axios";

export default {
  name: "axios-example",
  setup() {
    const id = ref(1);
    const { data, loading, exec, error, status } = useAxios();

    watch(id, id => {
      exec({
        method: "GET",
        url: "https://reqres.in/api/user/" + id
      });
    });

    return {
      id,
      data,
      loading,
      status
    };
  }
};
</script>

Contributing

  • Fork it!
  • Create your feature branch: git checkout -b feat/new-composable
  • Commit your changes: git commit -am 'feat(composable): add a new composable'
  • Push to the branch: git push origin feat/new-composable
  • Submit a pull request

Build

# install packages
yarn

# build and test for v2
yarn build --version=2
yarn test:vue2

# build and test for v3
yarn build
yarn test

New composable

  • Fork it!
  • Create your feature branch: git checkout -b feat/new-composable
  • Commit your changes: git commit -am 'feat(composable): add a new composable'
  • Push to the branch: git push origin feat/new-composable
  • Submit a pull request

License

MIT

Keywords

vue

FAQs

Package last updated on 17 Oct 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts