Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@aspida/swr

Package Overview
Dependencies
Maintainers
3
Versions
37
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@aspida/swr - npm Package Compare versions

Comparing version 1.12.0 to 1.13.0

dist/cjs/index.d.ts

19

package.json
{
"name": "@aspida/swr",
"version": "1.12.0",
"version": "1.13.0",
"description": "SWR wrapper for aspida",
"author": "Solufa <solufa2020@gmail.com>",
"license": "MIT",
"main": "dist/index.js",
"types": "dist/index.d.ts",
"main": "./dist/cjs/index.js",
"module": "./dist/esm/index.js",
"bin": "./bin/index.js",
"exports": {
".": {
"require": "./dist/cjs/index.js",
"import": "./dist/esm/index.js",
"types": "./dist/esm/index.d.ts"
},
"./package.json": "./package.json"
},
"homepage": "https://github.com/aspida/aspida/tree/master/packages/aspida-swr#readme",

@@ -29,4 +38,4 @@ "repository": {

"dependencies": {
"aspida": "^1.12.0"
"aspida": "^1.13.0"
}
}
}

@@ -12,8 +12,2 @@ # @aspida/swr

</a>
<a href="https://github.com/aspida/aspida/actions?query=workflow%3A%22Node.js+CI%22">
<img src="https://github.com/aspida/aspida/workflows/Node.js%20CI/badge.svg?branch=master" alt="Node.js CI" />
</a>
<a href="https://lgtm.com/projects/g/aspida/aspida/context:javascript">
<img src="https://img.shields.io/lgtm/grade/javascript/g/aspida/aspida.svg" alt="Language grade: JavaScript" />
</a>
</div>

@@ -50,14 +44,14 @@ <br />

```tsx
import useAspidaSWR from "@aspida/swr"
import aspida from "@aspida/axios" // "@aspida/fetch", "@aspida/node-fetch"
import api from "../api/$api"
import aspida from "@aspida/axios"; // "@aspida/fetch", "@aspida/node-fetch"
import useAspidaSWR from "@aspida/swr";
import api from "../api/$api";
const client = api(aspida())
const client = api(aspida());
function Profile() {
const { data, error } = useAspidaSWR(client.user._userId(123), { query: { name: "mario" } })
const { data, error } = useAspidaSWR(client.user._userId(123), { query: { name: "mario" } });
if (error) return <div>failed to load</div>
if (!data) return <div>loading...</div>
return <div>hello {data.name}!</div>
if (error) return <div>failed to load</div>;
if (!data) return <div>loading...</div>;
return <div>hello {data.name}!</div>;
}

@@ -71,15 +65,15 @@ ```

```tsx
import useAspidaSWR from "@aspida/swr"
import aspida from "@aspida/axios" // "@aspida/fetch", "@aspida/node-fetch"
import api from "../api/$api"
import aspida from "@aspida/axios"; // "@aspida/fetch", "@aspida/node-fetch"
import useAspidaSWR from "@aspida/swr";
import api from "../api/$api";
const client = api(aspida())
const client = api(aspida());
function Profile() {
const { data, error } = useAspidaSWR(client.user._userId(123), "get", {
query: { name: "mario" }
})
query: { name: "mario" },
});
if (error) return <div>failed to load</div>
if (!data) return <div>loading...</div>
if (error) return <div>failed to load</div>;
if (!data) return <div>loading...</div>;
return (

@@ -91,3 +85,3 @@ <>

</>
)
);
}

@@ -103,7 +97,7 @@ ```

```tsx
import useAspidaSWR from "@aspida/swr"
import aspida from "@aspida/axios" // "@aspida/fetch", "@aspida/node-fetch"
import api from "../api/$api"
import aspida from "@aspida/axios"; // "@aspida/fetch", "@aspida/node-fetch"
import useAspidaSWR from "@aspida/swr";
import api from "../api/$api";
const client = api(aspida())
const client = api(aspida());

@@ -114,7 +108,7 @@ function Profile() {

revalidateOnMount: true,
initialData: { name: "anonymous" }
})
initialData: { name: "anonymous" },
});
if (error) return <div>failed to load</div>
return <div>hello {data.name}!</div>
if (error) return <div>failed to load</div>;
return <div>hello {data.name}!</div>;
}

@@ -128,7 +122,7 @@ ```

```ts
const { data: user } = useAspidaSWR(client.user)
const { data: user } = useAspidaSWR(client.user);
const { data } = useAspidaSWR(client.articles, {
query: { userId: user?.id ?? 0 },
enabled: !!user
})
enabled: !!user,
});
// is an alias of

@@ -138,3 +132,3 @@ const { data } = useSWR(

() => client.articles.$get({ query: { userId: user.id } })
)
);
```

@@ -141,0 +135,0 @@

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc