touchstudy-core 0.1.63 → 0.1.65

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.
@@ -5,7 +5,7 @@ declare type LoginInfo = {
5
5
  captcha: string;
6
6
  rememberMe: boolean;
7
7
  };
8
- declare const useLogin: (history: any) => {
8
+ declare const useLogin: () => {
9
9
  defaultInfo: LoginInfo;
10
10
  openLogin: boolean;
11
11
  toggle: () => void;
package/dist/index.js CHANGED
@@ -499,8 +499,16 @@ var useGoogleSignOut = function useGoogleSignOut(props) {
499
499
  };
500
500
  };
501
501
 
502
- var pushTo = function pushTo(history, data) {
503
- if (history.push) history.push(data);else history(data);
502
+ var pushTo = function pushTo(history, data, isReplace) {
503
+ if (isReplace === void 0) {
504
+ isReplace = false;
505
+ }
506
+ if (history.push && !isReplace || history.replace && isReplace) {
507
+ !isReplace && history.push(data);
508
+ isReplace && history.replace(data);
509
+ } else history(data, {
510
+ replace: isReplace
511
+ });
504
512
  };
505
513
 
506
514
  var getErrorMessage = function getErrorMessage(t, error, defaultErrorMessage) {
@@ -936,7 +944,7 @@ var defaultInfo = {
936
944
  captcha: "",
937
945
  rememberMe: false
938
946
  };
939
- var useLogin$1 = function useLogin(history) {
947
+ var useLogin$1 = function useLogin() {
940
948
  var _useState = React.useState(false),
941
949
  openLogin = _useState[0],
942
950
  setOpenLogin = _useState[1];
@@ -960,7 +968,7 @@ var useLogin$1 = function useLogin(history) {
960
968
  }, [gapiScript.gapi]);
961
969
  React.useEffect(function () {
962
970
  var token = getAccessToken();
963
- if (!!token) pushTo(history, "/");
971
+ if (token) window.location.href = "/";
964
972
  }, []);
965
973
  return {
966
974
  defaultInfo: defaultInfo,
@@ -1019,8 +1027,9 @@ var useLanguage = function useLanguage(history) {
1019
1027
  var search = window.location.search;
1020
1028
  var searchParams = new URLSearchParams(search);
1021
1029
  if (!languageItem) {
1030
+ var _navigator$language, _navigator$language$s;
1022
1031
  var storedLanguage = getLanguage();
1023
- var browserLanguage = navigator.language;
1032
+ var browserLanguage = (_navigator$language = navigator.language) === null || _navigator$language === void 0 ? void 0 : (_navigator$language$s = _navigator$language.split("-")) === null || _navigator$language$s === void 0 ? void 0 : _navigator$language$s[0];
1024
1033
  var defaultLanguageCode = storedLanguage || browserLanguage;
1025
1034
  languageItem = LANGUAGES.find(function (i) {
1026
1035
  return i.code === defaultLanguageCode;
@@ -1034,7 +1043,7 @@ var useLanguage = function useLanguage(history) {
1034
1043
  searchParams.set("lang", languageItem.code);
1035
1044
  pushTo(history, _extends({}, window.location, {
1036
1045
  search: searchParams.toString()
1037
- }));
1046
+ }), true);
1038
1047
  };
1039
1048
  var handleChangeLanguageParam = function handleChangeLanguageParam() {
1040
1049
  var search = window.location.search;
@@ -1070,7 +1079,7 @@ var _excluded = ["history"];
1070
1079
  var Login = function Login(_ref) {
1071
1080
  var history = _ref.history,
1072
1081
  rest = _objectWithoutPropertiesLoose(_ref, _excluded);
1073
- var _useLogin = useLogin$1(history),
1082
+ var _useLogin = useLogin$1(),
1074
1083
  defaultInfo = _useLogin.defaultInfo;
1075
1084
  useLanguage(history);
1076
1085
  return React__default.createElement("div", {
@@ -1375,7 +1384,6 @@ var Loading = function Loading() {
1375
1384
  var isLoading = reactRedux.useSelector(function (state) {
1376
1385
  return state.common.isLoading;
1377
1386
  });
1378
- localStorage.setItem("LAST_TIME_REQUETST", moment().utc().format("YYYY-MM-DD HH:mm:ss"));
1379
1387
  return isLoading ? React__default.createElement("div", {
1380
1388
  style: loadingStyle
1381
1389
  }, React__default.createElement("div", {
@@ -1901,6 +1909,7 @@ var correct_answer_for_each_student = "학생별 정답 여부";
1901
1909
  var information_by_question = "문항별 정보";
1902
1910
  var no_data = "데이터 없음";
1903
1911
  var internet_connection_was_lost = "인터넷 연결이 끊어졌습니다";
1912
+ var internet_connection_is_back = "인터넷 연결이 다시 돌아왔습니다";
1904
1913
  var problem = "문제";
1905
1914
  var number_problem = "{{number}}문제";
1906
1915
  var problems = "문제";
@@ -2529,6 +2538,7 @@ var lang_ko = {
2529
2538
  information_by_question: information_by_question,
2530
2539
  no_data: no_data,
2531
2540
  internet_connection_was_lost: internet_connection_was_lost,
2541
+ internet_connection_is_back: internet_connection_is_back,
2532
2542
  problem: problem,
2533
2543
  number_problem: number_problem,
2534
2544
  problems: problems,
@@ -3147,7 +3157,8 @@ var question_time_for_each_student$1 = "Question time for each student";
3147
3157
  var correct_answer_for_each_student$1 = "Correct answer for each student";
3148
3158
  var information_by_question$1 = "Information by question";
3149
3159
  var no_data$1 = "No data";
3150
- var internet_connection_was_lost$1 = "Internet connection was lost";
3160
+ var internet_connection_was_lost$1 = "The internet connection was lost";
3161
+ var internet_connection_is_back$1 = "The internet connection is back";
3151
3162
  var problem$1 = "Problem";
3152
3163
  var number_problem$1 = "No.{{number}}";
3153
3164
  var problems$1 = "Problems";
@@ -3776,6 +3787,7 @@ var lang_en = {
3776
3787
  information_by_question: information_by_question$1,
3777
3788
  no_data: no_data$1,
3778
3789
  internet_connection_was_lost: internet_connection_was_lost$1,
3790
+ internet_connection_is_back: internet_connection_is_back$1,
3779
3791
  problem: problem$1,
3780
3792
  number_problem: number_problem$1,
3781
3793
  problems: problems$1,
@@ -9496,7 +9508,7 @@ var useAutoAcademyDomain = function useAutoAcademyDomain(logout, history, superU
9496
9508
  searchParams["delete"]("domain");
9497
9509
  pushTo(history, _extends({}, window.location, {
9498
9510
  search: searchParams.toString()
9499
- }));
9511
+ }), true);
9500
9512
  return;
9501
9513
  }
9502
9514
  } else {
@@ -9516,7 +9528,7 @@ var useAutoAcademyDomain = function useAutoAcademyDomain(logout, history, superU
9516
9528
  searchParams.set("domain", academyDomain);
9517
9529
  pushTo(history, _extends({}, window.location, {
9518
9530
  search: searchParams.toString()
9519
- }));
9531
+ }), true);
9520
9532
  return;
9521
9533
  }
9522
9534
  }
@@ -14400,7 +14412,7 @@ var useLogin$2 = function useLogin(_ref) {
14400
14412
  };
14401
14413
  React.useEffect(function () {
14402
14414
  var token = getAccessToken();
14403
- if (!!token) pushTo(history, "/");
14415
+ if (token) window.location.href = "/";
14404
14416
  }, []);
14405
14417
  return {
14406
14418
  handleSubmit: handleSubmit,