acsi-core 1.2.30 → 1.2.31
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.
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export declare const getGoogleClientId: () => Promise<import("axios").AxiosResponse<any, any>>;
|
|
2
|
-
export declare const apiLoginGoogle: (body: any) => Promise<import("axios").AxiosResponse<any, any>>;
|
|
3
|
-
export declare const apiSendEmailCode: (body: any) => Promise<import("axios").AxiosResponse<any, any>>;
|
|
4
|
-
export declare const apiCheckEmailCode: (params: any) => Promise<import("axios").AxiosResponse<any, any>>;
|
|
5
|
-
export declare const apiGetImage: () => Promise<import("axios").AxiosResponse<any, any>>;
|
|
1
|
+
export declare const getGoogleClientId: () => Promise<import("axios").AxiosResponse<any, any, {}>>;
|
|
2
|
+
export declare const apiLoginGoogle: (body: any) => Promise<import("axios").AxiosResponse<any, any, {}>>;
|
|
3
|
+
export declare const apiSendEmailCode: (body: any) => Promise<import("axios").AxiosResponse<any, any, {}>>;
|
|
4
|
+
export declare const apiCheckEmailCode: (params: any) => Promise<import("axios").AxiosResponse<any, any, {}>>;
|
|
5
|
+
export declare const apiGetImage: () => Promise<import("axios").AxiosResponse<any, any, {}>>;
|
package/dist/index.js
CHANGED
|
@@ -1838,8 +1838,7 @@ var msalConfig = function msalConfig(clientId, redirectUri) {
|
|
|
1838
1838
|
};
|
|
1839
1839
|
|
|
1840
1840
|
var BlockLogin = function BlockLogin(_ref) {
|
|
1841
|
-
var
|
|
1842
|
-
role = _ref.role,
|
|
1841
|
+
var role = _ref.role,
|
|
1843
1842
|
hiddenSignup = _ref.hiddenSignup,
|
|
1844
1843
|
email = _ref.email,
|
|
1845
1844
|
setEmail = _ref.setEmail,
|
|
@@ -1955,9 +1954,15 @@ var BlockLogin = function BlockLogin(_ref) {
|
|
|
1955
1954
|
var redirectUrl = getRedirectUrl(authResult.data.role);
|
|
1956
1955
|
window.location.href = redirectUrl + "/dashboard";
|
|
1957
1956
|
dispatch(setLoading(false));
|
|
1957
|
+
} else {
|
|
1958
|
+
var _authResult$data2, _authResult$data2$rol, _authResult$data3;
|
|
1959
|
+
localStorage.setItem(ACCESS_TOKEN, tokenJWT);
|
|
1960
|
+
var domain = "/teacher";
|
|
1961
|
+
if ((_authResult$data2 = authResult.data) !== null && _authResult$data2 !== void 0 && (_authResult$data2$rol = _authResult$data2.roles) !== null && _authResult$data2$rol !== void 0 && _authResult$data2$rol.includes("Admin") || ((_authResult$data3 = authResult.data) === null || _authResult$data3 === void 0 ? void 0 : _authResult$data3.role) === "Admin") {
|
|
1962
|
+
domain = "/admin";
|
|
1963
|
+
}
|
|
1964
|
+
window.location.href = domain + "/dashboard";
|
|
1958
1965
|
}
|
|
1959
|
-
localStorage.setItem(ACCESS_TOKEN, tokenJWT);
|
|
1960
|
-
onNavigate("/dashboard");
|
|
1961
1966
|
dispatch(setLoading(false));
|
|
1962
1967
|
});
|
|
1963
1968
|
}
|
|
@@ -2006,8 +2011,8 @@ var BlockLogin = function BlockLogin(_ref) {
|
|
|
2006
2011
|
};
|
|
2007
2012
|
dispatch(setLoading(true));
|
|
2008
2013
|
return Promise.resolve(apiLoginGoogle(infoLogin)).then(function (authResult) {
|
|
2009
|
-
var _authResult$
|
|
2010
|
-
if (((_authResult$
|
|
2014
|
+
var _authResult$data4;
|
|
2015
|
+
if (((_authResult$data4 = authResult.data) === null || _authResult$data4 === void 0 ? void 0 : _authResult$data4.id) == null) {
|
|
2011
2016
|
dispatch(setLoading(false));
|
|
2012
2017
|
alert("Please contact admin.");
|
|
2013
2018
|
return;
|
|
@@ -2042,9 +2047,15 @@ var BlockLogin = function BlockLogin(_ref) {
|
|
|
2042
2047
|
var redirectUrl = getRedirectUrl(authResult.data.role);
|
|
2043
2048
|
window.location.href = redirectUrl + "/dashboard";
|
|
2044
2049
|
dispatch(setLoading(false));
|
|
2050
|
+
} else {
|
|
2051
|
+
var _authResult$data5, _authResult$data5$rol, _authResult$data6;
|
|
2052
|
+
localStorage.setItem(ACCESS_TOKEN, tokenJWT);
|
|
2053
|
+
var domain = "/teacher";
|
|
2054
|
+
if ((_authResult$data5 = authResult.data) !== null && _authResult$data5 !== void 0 && (_authResult$data5$rol = _authResult$data5.roles) !== null && _authResult$data5$rol !== void 0 && _authResult$data5$rol.includes("Admin") || ((_authResult$data6 = authResult.data) === null || _authResult$data6 === void 0 ? void 0 : _authResult$data6.role) === "Admin") {
|
|
2055
|
+
domain = "/admin";
|
|
2056
|
+
}
|
|
2057
|
+
window.location.href = domain + "/dashboard";
|
|
2045
2058
|
}
|
|
2046
|
-
localStorage.setItem(ACCESS_TOKEN, tokenJWT);
|
|
2047
|
-
onNavigate("/dashboard");
|
|
2048
2059
|
dispatch(setLoading(false));
|
|
2049
2060
|
});
|
|
2050
2061
|
}
|
|
@@ -2509,9 +2520,14 @@ var useLogin = function useLogin(onNavigate, trackEvent) {
|
|
|
2509
2520
|
if ((_data$data$roles = data.data.roles) !== null && _data$data$roles !== void 0 && _data$data$roles.includes("Admin")) {
|
|
2510
2521
|
domain = ADMIN_ORIGIN;
|
|
2511
2522
|
}
|
|
2512
|
-
|
|
2523
|
+
onNavigate(domain + "/dashboard");
|
|
2513
2524
|
} else {
|
|
2514
|
-
|
|
2525
|
+
var _data$data$roles2;
|
|
2526
|
+
var _domain = "/teacher";
|
|
2527
|
+
if ((_data$data$roles2 = data.data.roles) !== null && _data$data$roles2 !== void 0 && _data$data$roles2.includes("Admin")) {
|
|
2528
|
+
_domain = "/admin";
|
|
2529
|
+
}
|
|
2530
|
+
onNavigate(_domain + "/dashboard");
|
|
2515
2531
|
}
|
|
2516
2532
|
} else {
|
|
2517
2533
|
reactToastify.toast.error("The code is not correct. Please check again.");
|