1.0.0 • Published 2 years ago

@pacdora-shared/request v1.0.0

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

@pacdora-shared/request

This version is just used to demonstrate structure of the package.

What is included in this package?

Pacdora services and request instance.

Requirements

  • axios

How to setup

1. Provide axios static

For example, you can write a nuxt plugin to configure axios and inject apis into context(or not).

import * as apis from './service';
import { configureAxios } from '@pacdora-shared/request/axios';

const toServerSideLang = () => 'zh-cn';

const ApiPlugin = (context, inject) => {
  configureAxios(context.$axios, toServerSideLang);
  inject('api', apis);
};

export default ApiPlugin;

2. Import api

Import api which you'd like to use from '@pacdora-shared/request/pacdora-service/'. Or you can import all apis from the pacdora-service/ path.

import * as overseaService from '@pacdora-shared/request/pacdora-service/';

Features

  • retrieve depths support
  • clean and no side effect
  • only axios is required
  • easy to use