0.1.3 • Published 1 year ago

openapi-axios-query v0.1.3

Weekly downloads
-
License
ISC
Repository
github
Last release
1 year ago

Usage

Generate paths with openapi-typescript. Then you can create a client.

import axios from "axios";
import { paths } from "./schema";
import { createClient } from "openapi-axios-query";
import { QueryClient } from "@tanstack/react-query";

const queryClient = new QueryClient();

const client = createClient<paths>({
  baseURL: "https://api.my-website.com",
  axios,
  context: queryClient,
});

// Use typed axios
const response = await client.axios("/v1/my-api");

// Or use typed query
const { data } = client.useQuery({
  url: "/v1/my-api",
  options: {},
});

// Or typed query helpers
const { invalidateQueries } = client.useQueryHelpers();
invalidateQueries({ queryKey: ["/v1/my-api"] }),
0.1.3

1 year ago

0.1.0

1 year ago

0.1.1

1 year ago

0.0.13

1 year ago

0.0.12

1 year ago

0.0.11

2 years ago

0.0.10

2 years ago

0.0.9

2 years ago

0.0.8

2 years ago

0.0.7

2 years ago

0.0.6

2 years ago

0.0.5

2 years ago

0.0.4

2 years ago

0.0.3

2 years ago

0.0.2

2 years ago

0.0.1

2 years ago

0.0.0

2 years ago