npm

@whalecloud/dx-fr-api
TypeScript icon, indicating that this package has built-in type declarations

0.0.2 • Public • Published

1. Setup

Let's install the packages we need:

npm install @whalecloud/dx-fr-api

2. learn GraphQLClient

@whalecloud/dx-fr-api use @fishx/graphql-client

@fishx/graphql-client

3. Initialize GraphQLClient

import React from 'react';
import { render } from 'react-dom';
import {
  useDxGraphQLClient,
  DxApiConatiner
} from "@whalecloud/dx-fr-api";
import { GraphQLClient } from '@fishx/graphql-client';
import axios from 'axios';

export const defRequest = axios.create({
  timeout: 10000,
  baseURL: '/portal/api',
  headers: {
    'X-Requested-With': 'XMLHttpRequest',
  },
});

export const defClient = new GraphQLClient('/portal/api/graphql', {
  headers: {
    'X-Requested-With': 'XMLHttpRequest',
  },
});




function App() {
  // 使用
  // const client = useDxGraphQLClient();
  return (
    <div>
      <h2>My first GraphQL app 🚀</h2>
    </div>
  );
}

render(
  <DxApiConatiner client={client}>
    <App />
  </DxApiConatiner>,
  document.getElementById('root'),
);

Readme

Keywords

Package Sidebar

Install

npm i @whalecloud/dx-fr-api

Weekly Downloads

1

Version

0.0.2

License

MIT

Unpacked Size

24 kB

Total Files

21

Last publish

Collaborators

  • whalecloud-developer