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