@bagelink/auth 1.6.67 → 1.6.73
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/index.cjs +2 -4
- package/dist/index.mjs +2 -4
- package/dist/useAuth.d.ts +4 -2
- package/package.json +1 -1
- package/src/useAuth.ts +6 -6
package/dist/index.cjs
CHANGED
|
@@ -1905,11 +1905,9 @@ function accountToUser(account) {
|
|
|
1905
1905
|
let authApi = null;
|
|
1906
1906
|
let eventEmitter = null;
|
|
1907
1907
|
const accountInfo = vue.ref(null);
|
|
1908
|
-
function initAuth({
|
|
1909
|
-
baseURL
|
|
1910
|
-
}) {
|
|
1908
|
+
function initAuth(params = { baseURL: "/api" }) {
|
|
1911
1909
|
if (authApi === null) {
|
|
1912
|
-
authApi = new AuthApi(baseURL);
|
|
1910
|
+
authApi = new AuthApi(params.baseURL);
|
|
1913
1911
|
}
|
|
1914
1912
|
if (eventEmitter === null) {
|
|
1915
1913
|
eventEmitter = new EventEmitter();
|
package/dist/index.mjs
CHANGED
|
@@ -1903,11 +1903,9 @@ function accountToUser(account) {
|
|
|
1903
1903
|
let authApi = null;
|
|
1904
1904
|
let eventEmitter = null;
|
|
1905
1905
|
const accountInfo = ref(null);
|
|
1906
|
-
function initAuth({
|
|
1907
|
-
baseURL
|
|
1908
|
-
}) {
|
|
1906
|
+
function initAuth(params = { baseURL: "/api" }) {
|
|
1909
1907
|
if (authApi === null) {
|
|
1910
|
-
authApi = new AuthApi(baseURL);
|
|
1908
|
+
authApi = new AuthApi(params.baseURL);
|
|
1911
1909
|
}
|
|
1912
1910
|
if (eventEmitter === null) {
|
|
1913
1911
|
eventEmitter = new EventEmitter();
|
package/dist/useAuth.d.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { App } from 'vue';
|
|
2
2
|
import { AccountInfo, User, NewUser, UpdatePasswordForm, UpdateAccountRequest, AuthEventMap, SSOProvider, SSOInitiateRequest, SSOCallbackRequest, SSOLinkRequest, AuthState } from './types';
|
|
3
|
-
|
|
3
|
+
interface InitParams {
|
|
4
4
|
baseURL: string;
|
|
5
|
-
}
|
|
5
|
+
}
|
|
6
|
+
export declare function initAuth(params?: InitParams): {
|
|
6
7
|
on<K extends AuthState>(event: K, handler: AuthEventMap[K]): void;
|
|
7
8
|
off<K extends AuthState>(event: K, handler: AuthEventMap[K]): void;
|
|
8
9
|
removeAllListeners<K extends AuthState>(event?: K): void;
|
|
@@ -110,3 +111,4 @@ export declare function useAuth(): {
|
|
|
110
111
|
revokeSession: (sessionToken: string) => Promise<void>;
|
|
111
112
|
revokeAllSessions: (accountId?: string) => Promise<void>;
|
|
112
113
|
};
|
|
114
|
+
export {};
|
package/package.json
CHANGED
package/src/useAuth.ts
CHANGED
|
@@ -22,14 +22,14 @@ let authApi: AuthApi | null = null
|
|
|
22
22
|
let eventEmitter: EventEmitter | null = null
|
|
23
23
|
const accountInfo = ref<AccountInfo | null>(null)
|
|
24
24
|
|
|
25
|
-
|
|
26
|
-
export function initAuth({
|
|
27
|
-
baseURL,
|
|
28
|
-
}: {
|
|
25
|
+
interface InitParams {
|
|
29
26
|
baseURL: string
|
|
30
|
-
}
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
// Initialize auth
|
|
30
|
+
export function initAuth(params: InitParams = { baseURL: '/api' }) {
|
|
31
31
|
if (authApi === null) {
|
|
32
|
-
authApi = new AuthApi(baseURL)
|
|
32
|
+
authApi = new AuthApi(params.baseURL)
|
|
33
33
|
}
|
|
34
34
|
|
|
35
35
|
if (eventEmitter === null) {
|