@glissandoo/lib 1.0.25 → 1.0.26
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/helpers/auth.d.ts +2 -1
- package/helpers/auth.js +6 -5
- package/package.json +1 -1
package/helpers/auth.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { LanguagesTypes } from '../lang';
|
|
1
2
|
import { GroupPlayerRole } from '../models/Group/Player/types';
|
|
2
3
|
export interface AuthUserClaims {
|
|
3
4
|
groups?: Record<string, GroupPlayerRole>;
|
|
@@ -17,4 +18,4 @@ export interface AuthURLParams {
|
|
|
17
18
|
error?: string;
|
|
18
19
|
return_to?: string;
|
|
19
20
|
}
|
|
20
|
-
export declare const
|
|
21
|
+
export declare const getAuthURL: (path: string, lang: LanguagesTypes, params?: AuthURLParams | undefined) => string;
|
package/helpers/auth.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
4
|
-
const
|
|
3
|
+
exports.getAuthURL = exports.AuthErrors = void 0;
|
|
4
|
+
const lang_1 = require("../lang");
|
|
5
|
+
const AUTH_HOST = 'https://auth.glissandoo.com';
|
|
5
6
|
var AuthErrors;
|
|
6
7
|
(function (AuthErrors) {
|
|
7
8
|
AuthErrors["NoSuperAdmin"] = "error.auth.notSuperadmin";
|
|
@@ -11,8 +12,8 @@ var AuthErrors;
|
|
|
11
12
|
AuthErrors["NoPartnerhispAdmin"] = "error.auth.noPartnershipAdmin";
|
|
12
13
|
AuthErrors["Unauthenticated"] = "error.auth.unauthenticated";
|
|
13
14
|
})(AuthErrors = exports.AuthErrors || (exports.AuthErrors = {}));
|
|
14
|
-
const
|
|
15
|
-
const url = new URL(
|
|
15
|
+
const getAuthURL = (path, lang, params) => {
|
|
16
|
+
const url = new URL(lang === lang_1.defaultLocale ? path : path, AUTH_HOST);
|
|
16
17
|
if (params) {
|
|
17
18
|
for (const param of Object.entries(params)) {
|
|
18
19
|
url.searchParams.set(param[0], param[1]);
|
|
@@ -20,4 +21,4 @@ const getRedirectSignIn = (params) => {
|
|
|
20
21
|
}
|
|
21
22
|
return url.toString();
|
|
22
23
|
};
|
|
23
|
-
exports.
|
|
24
|
+
exports.getAuthURL = getAuthURL;
|