touchstudy-core 0.1.79 → 0.1.80
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.js
CHANGED
@@ -724,7 +724,8 @@ var BlockLogin = function BlockLogin(_ref) {
|
|
724
724
|
role = _ref$role === void 0 ? exports.Role.Student : _ref$role,
|
725
725
|
homeAcademyUrl = _ref.homeAcademyUrl,
|
726
726
|
homeUrl = _ref.homeUrl,
|
727
|
-
registerUrl = _ref.registerUrl
|
727
|
+
registerUrl = _ref.registerUrl,
|
728
|
+
clientId = _ref.clientId;
|
728
729
|
var language = reactRedux.useSelector(function (state) {
|
729
730
|
var _state$common;
|
730
731
|
return state === null || state === void 0 ? void 0 : (_state$common = state.common) === null || _state$common === void 0 ? void 0 : _state$common.language;
|
@@ -794,7 +795,7 @@ var BlockLogin = function BlockLogin(_ref) {
|
|
794
795
|
})), React__default.createElement("div", {
|
795
796
|
className: "p-0 mt-1 mb-4"
|
796
797
|
}, React__default.createElement(GoogleLogin__default, {
|
797
|
-
clientId:
|
798
|
+
clientId: clientId,
|
798
799
|
buttonText: t("sign_in_with_your_google_account"),
|
799
800
|
onSuccess: onSuccessGoogle,
|
800
801
|
onFailure: onFailureGoogle,
|
@@ -819,24 +820,29 @@ var useLogin$1 = function useLogin(homeAcademyUrl, homeUrl) {
|
|
819
820
|
var _useState2 = React.useState(),
|
820
821
|
infoUser = _useState2[0],
|
821
822
|
setInfoUser = _useState2[1];
|
823
|
+
var _useState3 = React.useState(),
|
824
|
+
clientId = _useState3[0],
|
825
|
+
setClientId = _useState3[1];
|
822
826
|
var _useTranslation = reactI18next.useTranslation(),
|
823
827
|
t = _useTranslation.t;
|
824
828
|
var toggle = React.useCallback(function () {
|
825
829
|
setOpenLogin(!openLogin);
|
826
830
|
}, [openLogin]);
|
827
|
-
var
|
828
|
-
isShowPassword =
|
829
|
-
setIsShowPassword =
|
831
|
+
var _useState4 = React.useState(false),
|
832
|
+
isShowPassword = _useState4[0],
|
833
|
+
setIsShowPassword = _useState4[1];
|
834
|
+
React.useEffect(function () {
|
835
|
+
setClientId(GOOGLE_CLIENT_ID);
|
836
|
+
}, []);
|
830
837
|
React.useEffect(function () {
|
831
838
|
var start = function start() {
|
832
839
|
gapiScript.gapi.client.init({
|
833
|
-
clientId:
|
840
|
+
clientId: clientId,
|
834
841
|
scope: "email"
|
835
842
|
});
|
836
843
|
};
|
837
|
-
|
838
|
-
|
839
|
-
}, [gapiScript.gapi]);
|
844
|
+
gapiScript.gapi && clientId && gapiScript.gapi.load("client:auth2", start);
|
845
|
+
}, [gapiScript.gapi, clientId]);
|
840
846
|
React.useEffect(function () {
|
841
847
|
var token = getAccessToken();
|
842
848
|
var academyDomain = getAcademyDomain();
|
@@ -847,6 +853,7 @@ var useLogin$1 = function useLogin(homeAcademyUrl, homeUrl) {
|
|
847
853
|
document.title = t("study_peak") + " | " + t(PAGE_TITLE);
|
848
854
|
}, [t]);
|
849
855
|
return {
|
856
|
+
clientId: clientId,
|
850
857
|
defaultInfo: defaultInfo,
|
851
858
|
openLogin: openLogin,
|
852
859
|
toggle: toggle,
|
@@ -956,7 +963,8 @@ var Login = function Login(_ref) {
|
|
956
963
|
var history = _ref.history,
|
957
964
|
rest = _objectWithoutPropertiesLoose(_ref, _excluded);
|
958
965
|
var _useLogin = useLogin$1(rest.homeAcademyUrl, rest.homeUrl),
|
959
|
-
defaultInfo = _useLogin.defaultInfo
|
966
|
+
defaultInfo = _useLogin.defaultInfo,
|
967
|
+
clientId = _useLogin.clientId;
|
960
968
|
useLanguage(history);
|
961
969
|
return React__default.createElement("div", {
|
962
970
|
className: styles["login"] + " font-family-lato"
|
@@ -968,9 +976,10 @@ var Login = function Login(_ref) {
|
|
968
976
|
item: true,
|
969
977
|
xs: 12,
|
970
978
|
className: "d-flex justify-content-center h-100 align-items-center"
|
971
|
-
}, React__default.createElement(BlockLogin, Object.assign({
|
979
|
+
}, clientId && React__default.createElement(BlockLogin, Object.assign({
|
972
980
|
defaultInfo: defaultInfo,
|
973
|
-
history: history
|
981
|
+
history: history,
|
982
|
+
clientId: clientId
|
974
983
|
}, rest)))));
|
975
984
|
};
|
976
985
|
|