@ametie/vue-muza-use 0.0.1 → 0.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +13 -9
- package/dist/index.cjs +1 -2
- package/dist/index.mjs +1 -1
- package/package.json +16 -2
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Vue Muza Use 🎹
|
|
2
2
|
|
|
3
|
-
[](https://www.npmjs.com/package/@ametie/vue-muza-use)
|
|
4
4
|
[](https://opensource.org/licenses/MIT)
|
|
5
5
|
[](https://vuejs.org/)
|
|
6
6
|
[](https://www.typescriptlang.org/)
|
|
@@ -11,6 +11,9 @@
|
|
|
11
11
|
|
|
12
12
|
---
|
|
13
13
|
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
14
17
|
## 🚀 Why is this cool?
|
|
15
18
|
|
|
16
19
|
* 🛡 **Zombie Retry Protection**
|
|
@@ -34,13 +37,13 @@
|
|
|
34
37
|
|
|
35
38
|
```bash
|
|
36
39
|
# npm
|
|
37
|
-
npm install @
|
|
40
|
+
npm install @ametie/vue-muza-use axios
|
|
38
41
|
|
|
39
42
|
# pnpm
|
|
40
|
-
pnpm add @
|
|
43
|
+
pnpm add @ametie/vue-muza-use axios
|
|
41
44
|
|
|
42
45
|
# yarn
|
|
43
|
-
yarn add @
|
|
46
|
+
yarn add @ametie/vue-muza-use axios
|
|
44
47
|
```
|
|
45
48
|
|
|
46
49
|
---
|
|
@@ -53,7 +56,7 @@ Use `createApiClient` for a "batteries-included" setup, or bring your own Axios
|
|
|
53
56
|
|
|
54
57
|
```typescript
|
|
55
58
|
import { createApp } from 'vue'
|
|
56
|
-
import { createApi, createApiClient, setAuthMonitor } from '@
|
|
59
|
+
import { createApi, createApiClient, setAuthMonitor } from '@ametie/vue-muza-use'
|
|
57
60
|
import App from './App.vue'
|
|
58
61
|
|
|
59
62
|
const app = createApp(App)
|
|
@@ -92,7 +95,7 @@ app.mount('#app')
|
|
|
92
95
|
|
|
93
96
|
```typescript
|
|
94
97
|
<script setup lang="ts">
|
|
95
|
-
import { useApi } from '@
|
|
98
|
+
import { useApi } from '@ametie/vue-muza-use'
|
|
96
99
|
|
|
97
100
|
interface User {
|
|
98
101
|
id: number
|
|
@@ -123,7 +126,7 @@ Typically used for forms. Pass a `ref` as `data`, and it automatically unwraps c
|
|
|
123
126
|
```typescript
|
|
124
127
|
<script setup lang="ts">
|
|
125
128
|
import { ref } from 'vue'
|
|
126
|
-
import { useApiPost } from '@
|
|
129
|
+
import { useApiPost } from '@ametie/vue-muza-use'
|
|
127
130
|
|
|
128
131
|
const formData = ref({ email: '', password: '' })
|
|
129
132
|
|
|
@@ -170,7 +173,7 @@ watch(searchQuery, (newVal) => {
|
|
|
170
173
|
Useful for complex filters where changing one filter should invalidate all pending requests on the page (or scope).
|
|
171
174
|
|
|
172
175
|
```typescript
|
|
173
|
-
import { useAbortController } from '@
|
|
176
|
+
import { useAbortController } from '@ametie/vue-muza-use'
|
|
174
177
|
|
|
175
178
|
// In your specific composable or component
|
|
176
179
|
const { execute } = useApi('/heavy-report', {
|
|
@@ -246,6 +249,7 @@ interface CreateApiClientOptions {
|
|
|
246
249
|
|
|
247
250
|
---
|
|
248
251
|
|
|
252
|
+
|
|
249
253
|
## 🔐 Auth & Refresh Logic
|
|
250
254
|
|
|
251
255
|
`vue-muza-use` implements a robust **Interceptor Queue** pattern for handling JWTs.
|
|
@@ -264,4 +268,4 @@ This happens transparently to your components. They just "wait" a bit longer for
|
|
|
264
268
|
|
|
265
269
|
## License
|
|
266
270
|
|
|
267
|
-
MIT © [
|
|
271
|
+
MIT © [Ametie](https://github.com/ametie)
|
package/dist/index.cjs
CHANGED
|
@@ -299,7 +299,6 @@ function useApiDelete(url, options) {
|
|
|
299
299
|
var import_axios = __toESM(require("axios"), 1);
|
|
300
300
|
|
|
301
301
|
// src/features/monitor.ts
|
|
302
|
-
var import_meta = {};
|
|
303
302
|
var AuthEventType = /* @__PURE__ */ ((AuthEventType2) => {
|
|
304
303
|
AuthEventType2["REFRESH_START"] = "AUTH_REFRESH_START";
|
|
305
304
|
AuthEventType2["REQUEST_QUEUED"] = "AUTH_REQUEST_QUEUED";
|
|
@@ -308,7 +307,7 @@ var AuthEventType = /* @__PURE__ */ ((AuthEventType2) => {
|
|
|
308
307
|
return AuthEventType2;
|
|
309
308
|
})(AuthEventType || {});
|
|
310
309
|
var defaultMonitor = (type, payload) => {
|
|
311
|
-
const isDev = typeof process !== "undefined" && process.env?.NODE_ENV === "development"
|
|
310
|
+
const isDev = typeof process !== "undefined" && process.env?.NODE_ENV === "development";
|
|
312
311
|
if (isDev) {
|
|
313
312
|
console.debug(`[AuthMonitor] ${type}`, payload);
|
|
314
313
|
}
|
package/dist/index.mjs
CHANGED
|
@@ -257,7 +257,7 @@ var AuthEventType = /* @__PURE__ */ ((AuthEventType2) => {
|
|
|
257
257
|
return AuthEventType2;
|
|
258
258
|
})(AuthEventType || {});
|
|
259
259
|
var defaultMonitor = (type, payload) => {
|
|
260
|
-
const isDev = typeof process !== "undefined" && process.env?.NODE_ENV === "development"
|
|
260
|
+
const isDev = typeof process !== "undefined" && process.env?.NODE_ENV === "development";
|
|
261
261
|
if (isDev) {
|
|
262
262
|
console.debug(`[AuthMonitor] ${type}`, payload);
|
|
263
263
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ametie/vue-muza-use",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.4",
|
|
4
4
|
"description": "Powerful Vue 3 API composable (Muza Kit) with Axios, Auto-Refresh & TypeScript",
|
|
5
5
|
"author": "MortyQ",
|
|
6
6
|
"license": "MIT",
|
|
@@ -13,7 +13,17 @@
|
|
|
13
13
|
"README.md",
|
|
14
14
|
"package.json"
|
|
15
15
|
],
|
|
16
|
-
"keywords": [
|
|
16
|
+
"keywords": [
|
|
17
|
+
"vue",
|
|
18
|
+
"axios",
|
|
19
|
+
"composable",
|
|
20
|
+
"api",
|
|
21
|
+
"typescript",
|
|
22
|
+
"request",
|
|
23
|
+
"auth",
|
|
24
|
+
"refresh",
|
|
25
|
+
"muza"
|
|
26
|
+
],
|
|
17
27
|
"type": "module",
|
|
18
28
|
"types": "./dist/index.d.ts",
|
|
19
29
|
"main": "./dist/index.cjs",
|
|
@@ -39,8 +49,12 @@
|
|
|
39
49
|
"vue": "^3.3.0"
|
|
40
50
|
},
|
|
41
51
|
"devDependencies": {
|
|
52
|
+
"@semantic-release/git": "^10.0.1",
|
|
53
|
+
"@semantic-release/github": "^12.0.3",
|
|
54
|
+
"@semantic-release/npm": "^13.1.3",
|
|
42
55
|
"@types/node": "^24.10.10",
|
|
43
56
|
"axios": "^1.13.4",
|
|
57
|
+
"semantic-release": "^25.0.3",
|
|
44
58
|
"tsup": "^8.5.1",
|
|
45
59
|
"typescript": "^5.9.3",
|
|
46
60
|
"vue": "^3.5.27"
|