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