@ministerjs/auth 1.0.0 → 1.0.2

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/dist/Auth.d.mts CHANGED
@@ -1,23 +1,6 @@
1
1
  import { Ref } from 'vue';
2
-
3
- type Methods = "get" | "post" | "put" | "patch" | "delete";
4
-
5
- interface FetchOptions<T> {
6
- method?: Methods | Uppercase<Methods>;
7
- body?: RequestInit["body"];
8
- query?: Record<string, any>;
9
- transform?: (data: any) => T;
10
- }
11
-
12
- interface FetchResponse<T> {
13
- ok: boolean;
14
- json(): Promise<T>;
15
- }
16
-
17
- type Fetch = <T>(
18
- url: string,
19
- options?: FetchOptions<T>,
20
- ) => Promise<FetchResponse<T>>;
2
+ import { Fetch } from '@ministerjs/resource';
3
+ export { Fetch, FetchOptions, FetchResponse } from '@ministerjs/resource';
21
4
 
22
5
  interface Options<User extends Record<string, any>> {
23
6
  fetch: Fetch;
@@ -48,4 +31,4 @@ declare class Auth<User extends Record<string, any>> {
48
31
  private setUser;
49
32
  }
50
33
 
51
- export { Auth, type Fetch, type FetchOptions, type FetchResponse };
34
+ export { Auth };
package/dist/Auth.d.ts CHANGED
@@ -1,23 +1,6 @@
1
1
  import { Ref } from 'vue';
2
-
3
- type Methods = "get" | "post" | "put" | "patch" | "delete";
4
-
5
- interface FetchOptions<T> {
6
- method?: Methods | Uppercase<Methods>;
7
- body?: RequestInit["body"];
8
- query?: Record<string, any>;
9
- transform?: (data: any) => T;
10
- }
11
-
12
- interface FetchResponse<T> {
13
- ok: boolean;
14
- json(): Promise<T>;
15
- }
16
-
17
- type Fetch = <T>(
18
- url: string,
19
- options?: FetchOptions<T>,
20
- ) => Promise<FetchResponse<T>>;
2
+ import { Fetch } from '@ministerjs/resource';
3
+ export { Fetch, FetchOptions, FetchResponse } from '@ministerjs/resource';
21
4
 
22
5
  interface Options<User extends Record<string, any>> {
23
6
  fetch: Fetch;
@@ -48,4 +31,4 @@ declare class Auth<User extends Record<string, any>> {
48
31
  private setUser;
49
32
  }
50
33
 
51
- export { Auth, type Fetch, type FetchOptions, type FetchResponse };
34
+ export { Auth };
package/dist/Auth.js CHANGED
@@ -57,14 +57,17 @@ var Auth = class {
57
57
  }
58
58
  async login(payload) {
59
59
  this.loading.value = true;
60
- const response = await this.fetch(this.routes.login, {
61
- method: "POST",
62
- body: JSON.stringify(payload)
63
- });
64
- this.on.value = true;
65
- const { data } = await response.json();
66
- this.setUser(data);
67
- this.loading.value = false;
60
+ try {
61
+ const response = await this.fetch(this.routes.login, {
62
+ method: "POST",
63
+ body: JSON.stringify(payload)
64
+ });
65
+ this.on.value = true;
66
+ const { data } = await response.json();
67
+ this.setUser(data);
68
+ } finally {
69
+ this.loading.value = false;
70
+ }
68
71
  }
69
72
  async checkIn() {
70
73
  this.loading.value = true;
package/dist/Auth.mjs CHANGED
@@ -33,14 +33,17 @@ var Auth = class {
33
33
  }
34
34
  async login(payload) {
35
35
  this.loading.value = true;
36
- const response = await this.fetch(this.routes.login, {
37
- method: "POST",
38
- body: JSON.stringify(payload)
39
- });
40
- this.on.value = true;
41
- const { data } = await response.json();
42
- this.setUser(data);
43
- this.loading.value = false;
36
+ try {
37
+ const response = await this.fetch(this.routes.login, {
38
+ method: "POST",
39
+ body: JSON.stringify(payload)
40
+ });
41
+ this.on.value = true;
42
+ const { data } = await response.json();
43
+ this.setUser(data);
44
+ } finally {
45
+ this.loading.value = false;
46
+ }
44
47
  }
45
48
  async checkIn() {
46
49
  this.loading.value = true;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ministerjs/auth",
3
- "version": "1.0.0",
3
+ "version": "1.0.2",
4
4
  "license": "UNLICENSED",
5
5
  "private": false,
6
6
  "publishConfig": {
@@ -20,24 +20,23 @@
20
20
  "vue": "^3.5.12"
21
21
  },
22
22
  "devDependencies": {
23
- "@eslint/js": "^9.14.0",
24
- "@ministerjs/build": "^2.0.2",
25
- "@types/node": "^22.13.5",
23
+ "@ministerjs/build": "^2.1.2",
24
+ "@ministerjs/resource": "1.2.0",
25
+ "@types/node": "^22.13.10",
26
26
  "cross-env": "^7.0.3",
27
27
  "eslint": "^9.22.0",
28
- "eslint-config-prettier": "^10.1.1",
29
- "globals": "^15.12.0",
28
+ "globals": "^15.15.0",
30
29
  "prettier": "3.5.3",
31
30
  "tsup": "^8.4.0",
32
31
  "tsx": "^4.19.3",
33
32
  "typescript": "latest",
34
- "typescript-eslint": "^8.12.2",
35
- "vue": "^3.5.12"
33
+ "vitest": "^3.0.9",
34
+ "vue": "^3.5.13"
36
35
  },
37
36
  "scripts": {
38
37
  "dev": "tsup --watch",
39
- "lint": "eslint ./src --fix",
40
- "build": "pnpm lint && tsup",
41
- "release": "pnpm publish --no-git-checks"
38
+ "lint": "eslint ./src --fix --config ../../eslint.config.mjs",
39
+ "test": "vitest run --root ../../ --project @ministerjs/auth",
40
+ "build": "pnpm lint && pnpm test && tsup"
42
41
  }
43
42
  }