touchstudy-core 0.1.3 → 0.1.5
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/containers/Login/hooks/useLogin.d.ts +1 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +166 -686
- package/dist/index.js.map +1 -1
- package/dist/index.modern.js +157 -678
- package/dist/index.modern.js.map +1 -1
- package/dist/layouts/LayoutContext.d.ts +1 -0
- package/dist/redux/commons/action.d.ts +1 -0
- package/dist/utils/constants.d.ts +1 -1
- package/dist/utils/isLocalHost.d.ts +2 -0
- package/dist/utils/useGoogleSignOut.d.ts +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; }
|
2
2
|
|
3
|
+
var history = require('history');
|
3
4
|
var toolkit = require('@reduxjs/toolkit');
|
4
5
|
var moment = _interopDefault(require('moment'));
|
5
6
|
var React = require('react');
|
@@ -17,607 +18,21 @@ var i18n = _interopDefault(require('i18next'));
|
|
17
18
|
var reactI18next = require('react-i18next');
|
18
19
|
var io5 = require('react-icons/io5');
|
19
20
|
|
20
|
-
function _extends() {
|
21
|
-
_extends = Object.assign ? Object.assign.bind() : function (target) {
|
22
|
-
for (var i = 1; i < arguments.length; i++) {
|
23
|
-
var source = arguments[i];
|
24
|
-
for (var key in source) {
|
25
|
-
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
26
|
-
target[key] = source[key];
|
27
|
-
}
|
28
|
-
}
|
29
|
-
}
|
30
|
-
return target;
|
31
|
-
};
|
32
|
-
return _extends.apply(this, arguments);
|
33
|
-
}
|
34
|
-
|
35
|
-
function isAbsolute(pathname) {
|
36
|
-
return pathname.charAt(0) === '/';
|
37
|
-
}
|
38
|
-
|
39
|
-
// About 1.5x faster than the two-arg version of Array#splice()
|
40
|
-
function spliceOne(list, index) {
|
41
|
-
for (var i = index, k = i + 1, n = list.length; k < n; i += 1, k += 1) {
|
42
|
-
list[i] = list[k];
|
43
|
-
}
|
44
|
-
|
45
|
-
list.pop();
|
46
|
-
}
|
47
|
-
|
48
|
-
// This implementation is based heavily on node's url.parse
|
49
|
-
function resolvePathname(to, from) {
|
50
|
-
if (from === undefined) from = '';
|
51
|
-
|
52
|
-
var toParts = (to && to.split('/')) || [];
|
53
|
-
var fromParts = (from && from.split('/')) || [];
|
54
|
-
|
55
|
-
var isToAbs = to && isAbsolute(to);
|
56
|
-
var isFromAbs = from && isAbsolute(from);
|
57
|
-
var mustEndAbs = isToAbs || isFromAbs;
|
58
|
-
|
59
|
-
if (to && isAbsolute(to)) {
|
60
|
-
// to is absolute
|
61
|
-
fromParts = toParts;
|
62
|
-
} else if (toParts.length) {
|
63
|
-
// to is relative, drop the filename
|
64
|
-
fromParts.pop();
|
65
|
-
fromParts = fromParts.concat(toParts);
|
66
|
-
}
|
67
|
-
|
68
|
-
if (!fromParts.length) return '/';
|
69
|
-
|
70
|
-
var hasTrailingSlash;
|
71
|
-
if (fromParts.length) {
|
72
|
-
var last = fromParts[fromParts.length - 1];
|
73
|
-
hasTrailingSlash = last === '.' || last === '..' || last === '';
|
74
|
-
} else {
|
75
|
-
hasTrailingSlash = false;
|
76
|
-
}
|
77
|
-
|
78
|
-
var up = 0;
|
79
|
-
for (var i = fromParts.length; i >= 0; i--) {
|
80
|
-
var part = fromParts[i];
|
81
|
-
|
82
|
-
if (part === '.') {
|
83
|
-
spliceOne(fromParts, i);
|
84
|
-
} else if (part === '..') {
|
85
|
-
spliceOne(fromParts, i);
|
86
|
-
up++;
|
87
|
-
} else if (up) {
|
88
|
-
spliceOne(fromParts, i);
|
89
|
-
up--;
|
90
|
-
}
|
91
|
-
}
|
92
|
-
|
93
|
-
if (!mustEndAbs) for (; up--; up) fromParts.unshift('..');
|
94
|
-
|
95
|
-
if (
|
96
|
-
mustEndAbs &&
|
97
|
-
fromParts[0] !== '' &&
|
98
|
-
(!fromParts[0] || !isAbsolute(fromParts[0]))
|
99
|
-
)
|
100
|
-
fromParts.unshift('');
|
101
|
-
|
102
|
-
var result = fromParts.join('/');
|
103
|
-
|
104
|
-
if (hasTrailingSlash && result.substr(-1) !== '/') result += '/';
|
105
|
-
|
106
|
-
return result;
|
107
|
-
}
|
108
|
-
|
109
|
-
var isProduction = process.env.NODE_ENV === 'production';
|
110
|
-
function warning(condition, message) {
|
111
|
-
if (!isProduction) {
|
112
|
-
if (condition) {
|
113
|
-
return;
|
114
|
-
}
|
115
|
-
|
116
|
-
var text = "Warning: " + message;
|
117
|
-
|
118
|
-
if (typeof console !== 'undefined') {
|
119
|
-
console.warn(text);
|
120
|
-
}
|
121
|
-
|
122
|
-
try {
|
123
|
-
throw Error(text);
|
124
|
-
} catch (x) {}
|
125
|
-
}
|
126
|
-
}
|
127
|
-
|
128
|
-
var isProduction$1 = process.env.NODE_ENV === 'production';
|
129
|
-
var prefix = 'Invariant failed';
|
130
|
-
function invariant(condition, message) {
|
131
|
-
if (condition) {
|
132
|
-
return;
|
133
|
-
}
|
134
|
-
if (isProduction$1) {
|
135
|
-
throw new Error(prefix);
|
136
|
-
}
|
137
|
-
var provided = typeof message === 'function' ? message() : message;
|
138
|
-
var value = provided ? "".concat(prefix, ": ").concat(provided) : prefix;
|
139
|
-
throw new Error(value);
|
140
|
-
}
|
141
|
-
|
142
|
-
function addLeadingSlash(path) {
|
143
|
-
return path.charAt(0) === '/' ? path : '/' + path;
|
144
|
-
}
|
145
|
-
function hasBasename(path, prefix) {
|
146
|
-
return path.toLowerCase().indexOf(prefix.toLowerCase()) === 0 && '/?#'.indexOf(path.charAt(prefix.length)) !== -1;
|
147
|
-
}
|
148
|
-
function stripBasename(path, prefix) {
|
149
|
-
return hasBasename(path, prefix) ? path.substr(prefix.length) : path;
|
150
|
-
}
|
151
|
-
function stripTrailingSlash(path) {
|
152
|
-
return path.charAt(path.length - 1) === '/' ? path.slice(0, -1) : path;
|
153
|
-
}
|
154
|
-
function parsePath(path) {
|
155
|
-
var pathname = path || '/';
|
156
|
-
var search = '';
|
157
|
-
var hash = '';
|
158
|
-
var hashIndex = pathname.indexOf('#');
|
159
|
-
|
160
|
-
if (hashIndex !== -1) {
|
161
|
-
hash = pathname.substr(hashIndex);
|
162
|
-
pathname = pathname.substr(0, hashIndex);
|
163
|
-
}
|
164
|
-
|
165
|
-
var searchIndex = pathname.indexOf('?');
|
166
|
-
|
167
|
-
if (searchIndex !== -1) {
|
168
|
-
search = pathname.substr(searchIndex);
|
169
|
-
pathname = pathname.substr(0, searchIndex);
|
170
|
-
}
|
171
|
-
|
172
|
-
return {
|
173
|
-
pathname: pathname,
|
174
|
-
search: search === '?' ? '' : search,
|
175
|
-
hash: hash === '#' ? '' : hash
|
176
|
-
};
|
177
|
-
}
|
178
|
-
function createPath(location) {
|
179
|
-
var pathname = location.pathname,
|
180
|
-
search = location.search,
|
181
|
-
hash = location.hash;
|
182
|
-
var path = pathname || '/';
|
183
|
-
if (search && search !== '?') path += search.charAt(0) === '?' ? search : "?" + search;
|
184
|
-
if (hash && hash !== '#') path += hash.charAt(0) === '#' ? hash : "#" + hash;
|
185
|
-
return path;
|
186
|
-
}
|
187
|
-
|
188
|
-
function createLocation(path, state, key, currentLocation) {
|
189
|
-
var location;
|
190
|
-
|
191
|
-
if (typeof path === 'string') {
|
192
|
-
// Two-arg form: push(path, state)
|
193
|
-
location = parsePath(path);
|
194
|
-
location.state = state;
|
195
|
-
} else {
|
196
|
-
// One-arg form: push(location)
|
197
|
-
location = _extends({}, path);
|
198
|
-
if (location.pathname === undefined) location.pathname = '';
|
199
|
-
|
200
|
-
if (location.search) {
|
201
|
-
if (location.search.charAt(0) !== '?') location.search = '?' + location.search;
|
202
|
-
} else {
|
203
|
-
location.search = '';
|
204
|
-
}
|
205
|
-
|
206
|
-
if (location.hash) {
|
207
|
-
if (location.hash.charAt(0) !== '#') location.hash = '#' + location.hash;
|
208
|
-
} else {
|
209
|
-
location.hash = '';
|
210
|
-
}
|
211
|
-
|
212
|
-
if (state !== undefined && location.state === undefined) location.state = state;
|
213
|
-
}
|
214
|
-
|
215
|
-
try {
|
216
|
-
location.pathname = decodeURI(location.pathname);
|
217
|
-
} catch (e) {
|
218
|
-
if (e instanceof URIError) {
|
219
|
-
throw new URIError('Pathname "' + location.pathname + '" could not be decoded. ' + 'This is likely caused by an invalid percent-encoding.');
|
220
|
-
} else {
|
221
|
-
throw e;
|
222
|
-
}
|
223
|
-
}
|
224
|
-
|
225
|
-
if (key) location.key = key;
|
226
|
-
|
227
|
-
if (currentLocation) {
|
228
|
-
// Resolve incomplete/relative pathname relative to current location.
|
229
|
-
if (!location.pathname) {
|
230
|
-
location.pathname = currentLocation.pathname;
|
231
|
-
} else if (location.pathname.charAt(0) !== '/') {
|
232
|
-
location.pathname = resolvePathname(location.pathname, currentLocation.pathname);
|
233
|
-
}
|
234
|
-
} else {
|
235
|
-
// When there is no prior location and pathname is empty, set it to /
|
236
|
-
if (!location.pathname) {
|
237
|
-
location.pathname = '/';
|
238
|
-
}
|
239
|
-
}
|
240
|
-
|
241
|
-
return location;
|
242
|
-
}
|
243
|
-
|
244
|
-
function createTransitionManager() {
|
245
|
-
var prompt = null;
|
246
|
-
|
247
|
-
function setPrompt(nextPrompt) {
|
248
|
-
process.env.NODE_ENV !== "production" ? warning(prompt == null, 'A history supports only one prompt at a time') : void 0;
|
249
|
-
prompt = nextPrompt;
|
250
|
-
return function () {
|
251
|
-
if (prompt === nextPrompt) prompt = null;
|
252
|
-
};
|
253
|
-
}
|
254
|
-
|
255
|
-
function confirmTransitionTo(location, action, getUserConfirmation, callback) {
|
256
|
-
// TODO: If another transition starts while we're still confirming
|
257
|
-
// the previous one, we may end up in a weird state. Figure out the
|
258
|
-
// best way to handle this.
|
259
|
-
if (prompt != null) {
|
260
|
-
var result = typeof prompt === 'function' ? prompt(location, action) : prompt;
|
261
|
-
|
262
|
-
if (typeof result === 'string') {
|
263
|
-
if (typeof getUserConfirmation === 'function') {
|
264
|
-
getUserConfirmation(result, callback);
|
265
|
-
} else {
|
266
|
-
process.env.NODE_ENV !== "production" ? warning(false, 'A history needs a getUserConfirmation function in order to use a prompt message') : void 0;
|
267
|
-
callback(true);
|
268
|
-
}
|
269
|
-
} else {
|
270
|
-
// Return false from a transition hook to cancel the transition.
|
271
|
-
callback(result !== false);
|
272
|
-
}
|
273
|
-
} else {
|
274
|
-
callback(true);
|
275
|
-
}
|
276
|
-
}
|
277
|
-
|
278
|
-
var listeners = [];
|
279
|
-
|
280
|
-
function appendListener(fn) {
|
281
|
-
var isActive = true;
|
282
|
-
|
283
|
-
function listener() {
|
284
|
-
if (isActive) fn.apply(void 0, arguments);
|
285
|
-
}
|
286
|
-
|
287
|
-
listeners.push(listener);
|
288
|
-
return function () {
|
289
|
-
isActive = false;
|
290
|
-
listeners = listeners.filter(function (item) {
|
291
|
-
return item !== listener;
|
292
|
-
});
|
293
|
-
};
|
294
|
-
}
|
295
|
-
|
296
|
-
function notifyListeners() {
|
297
|
-
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
298
|
-
args[_key] = arguments[_key];
|
299
|
-
}
|
300
|
-
|
301
|
-
listeners.forEach(function (listener) {
|
302
|
-
return listener.apply(void 0, args);
|
303
|
-
});
|
304
|
-
}
|
305
|
-
|
306
|
-
return {
|
307
|
-
setPrompt: setPrompt,
|
308
|
-
confirmTransitionTo: confirmTransitionTo,
|
309
|
-
appendListener: appendListener,
|
310
|
-
notifyListeners: notifyListeners
|
311
|
-
};
|
312
|
-
}
|
313
|
-
|
314
|
-
var canUseDOM = !!(typeof window !== 'undefined' && window.document && window.document.createElement);
|
315
|
-
function getConfirmation(message, callback) {
|
316
|
-
callback(window.confirm(message)); // eslint-disable-line no-alert
|
317
|
-
}
|
318
|
-
/**
|
319
|
-
* Returns true if the HTML5 history API is supported. Taken from Modernizr.
|
320
|
-
*
|
321
|
-
* https://github.com/Modernizr/Modernizr/blob/master/LICENSE
|
322
|
-
* https://github.com/Modernizr/Modernizr/blob/master/feature-detects/history.js
|
323
|
-
* changed to avoid false negatives for Windows Phones: https://github.com/reactjs/react-router/issues/586
|
324
|
-
*/
|
325
|
-
|
326
|
-
function supportsHistory() {
|
327
|
-
var ua = window.navigator.userAgent;
|
328
|
-
if ((ua.indexOf('Android 2.') !== -1 || ua.indexOf('Android 4.0') !== -1) && ua.indexOf('Mobile Safari') !== -1 && ua.indexOf('Chrome') === -1 && ua.indexOf('Windows Phone') === -1) return false;
|
329
|
-
return window.history && 'pushState' in window.history;
|
330
|
-
}
|
331
|
-
/**
|
332
|
-
* Returns true if browser fires popstate on hash change.
|
333
|
-
* IE10 and IE11 do not.
|
334
|
-
*/
|
335
|
-
|
336
|
-
function supportsPopStateOnHashChange() {
|
337
|
-
return window.navigator.userAgent.indexOf('Trident') === -1;
|
338
|
-
}
|
339
|
-
/**
|
340
|
-
* Returns true if a given popstate event is an extraneous WebKit event.
|
341
|
-
* Accounts for the fact that Chrome on iOS fires real popstate events
|
342
|
-
* containing undefined state when pressing the back button.
|
343
|
-
*/
|
344
|
-
|
345
|
-
function isExtraneousPopstateEvent(event) {
|
346
|
-
return event.state === undefined && navigator.userAgent.indexOf('CriOS') === -1;
|
347
|
-
}
|
348
|
-
|
349
|
-
var PopStateEvent = 'popstate';
|
350
|
-
var HashChangeEvent = 'hashchange';
|
351
|
-
|
352
|
-
function getHistoryState() {
|
353
|
-
try {
|
354
|
-
return window.history.state || {};
|
355
|
-
} catch (e) {
|
356
|
-
// IE 11 sometimes throws when accessing window.history.state
|
357
|
-
// See https://github.com/ReactTraining/history/pull/289
|
358
|
-
return {};
|
359
|
-
}
|
360
|
-
}
|
361
|
-
/**
|
362
|
-
* Creates a history object that uses the HTML5 history API including
|
363
|
-
* pushState, replaceState, and the popstate event.
|
364
|
-
*/
|
365
|
-
|
366
|
-
|
367
|
-
function createBrowserHistory(props) {
|
368
|
-
if (props === void 0) {
|
369
|
-
props = {};
|
370
|
-
}
|
371
|
-
|
372
|
-
!canUseDOM ? process.env.NODE_ENV !== "production" ? invariant(false, 'Browser history needs a DOM') : invariant(false) : void 0;
|
373
|
-
var globalHistory = window.history;
|
374
|
-
var canUseHistory = supportsHistory();
|
375
|
-
var needsHashChangeListener = !supportsPopStateOnHashChange();
|
376
|
-
var _props = props,
|
377
|
-
_props$forceRefresh = _props.forceRefresh,
|
378
|
-
forceRefresh = _props$forceRefresh === void 0 ? false : _props$forceRefresh,
|
379
|
-
_props$getUserConfirm = _props.getUserConfirmation,
|
380
|
-
getUserConfirmation = _props$getUserConfirm === void 0 ? getConfirmation : _props$getUserConfirm,
|
381
|
-
_props$keyLength = _props.keyLength,
|
382
|
-
keyLength = _props$keyLength === void 0 ? 6 : _props$keyLength;
|
383
|
-
var basename = props.basename ? stripTrailingSlash(addLeadingSlash(props.basename)) : '';
|
384
|
-
|
385
|
-
function getDOMLocation(historyState) {
|
386
|
-
var _ref = historyState || {},
|
387
|
-
key = _ref.key,
|
388
|
-
state = _ref.state;
|
389
|
-
|
390
|
-
var _window$location = window.location,
|
391
|
-
pathname = _window$location.pathname,
|
392
|
-
search = _window$location.search,
|
393
|
-
hash = _window$location.hash;
|
394
|
-
var path = pathname + search + hash;
|
395
|
-
process.env.NODE_ENV !== "production" ? warning(!basename || hasBasename(path, basename), 'You are attempting to use a basename on a page whose URL path does not begin ' + 'with the basename. Expected path "' + path + '" to begin with "' + basename + '".') : void 0;
|
396
|
-
if (basename) path = stripBasename(path, basename);
|
397
|
-
return createLocation(path, state, key);
|
398
|
-
}
|
399
|
-
|
400
|
-
function createKey() {
|
401
|
-
return Math.random().toString(36).substr(2, keyLength);
|
402
|
-
}
|
403
|
-
|
404
|
-
var transitionManager = createTransitionManager();
|
405
|
-
|
406
|
-
function setState(nextState) {
|
407
|
-
_extends(history, nextState);
|
408
|
-
|
409
|
-
history.length = globalHistory.length;
|
410
|
-
transitionManager.notifyListeners(history.location, history.action);
|
411
|
-
}
|
412
|
-
|
413
|
-
function handlePopState(event) {
|
414
|
-
// Ignore extraneous popstate events in WebKit.
|
415
|
-
if (isExtraneousPopstateEvent(event)) return;
|
416
|
-
handlePop(getDOMLocation(event.state));
|
417
|
-
}
|
418
|
-
|
419
|
-
function handleHashChange() {
|
420
|
-
handlePop(getDOMLocation(getHistoryState()));
|
421
|
-
}
|
422
|
-
|
423
|
-
var forceNextPop = false;
|
424
|
-
|
425
|
-
function handlePop(location) {
|
426
|
-
if (forceNextPop) {
|
427
|
-
forceNextPop = false;
|
428
|
-
setState();
|
429
|
-
} else {
|
430
|
-
var action = 'POP';
|
431
|
-
transitionManager.confirmTransitionTo(location, action, getUserConfirmation, function (ok) {
|
432
|
-
if (ok) {
|
433
|
-
setState({
|
434
|
-
action: action,
|
435
|
-
location: location
|
436
|
-
});
|
437
|
-
} else {
|
438
|
-
revertPop(location);
|
439
|
-
}
|
440
|
-
});
|
441
|
-
}
|
442
|
-
}
|
443
|
-
|
444
|
-
function revertPop(fromLocation) {
|
445
|
-
var toLocation = history.location; // TODO: We could probably make this more reliable by
|
446
|
-
// keeping a list of keys we've seen in sessionStorage.
|
447
|
-
// Instead, we just default to 0 for keys we don't know.
|
448
|
-
|
449
|
-
var toIndex = allKeys.indexOf(toLocation.key);
|
450
|
-
if (toIndex === -1) toIndex = 0;
|
451
|
-
var fromIndex = allKeys.indexOf(fromLocation.key);
|
452
|
-
if (fromIndex === -1) fromIndex = 0;
|
453
|
-
var delta = toIndex - fromIndex;
|
454
|
-
|
455
|
-
if (delta) {
|
456
|
-
forceNextPop = true;
|
457
|
-
go(delta);
|
458
|
-
}
|
459
|
-
}
|
460
|
-
|
461
|
-
var initialLocation = getDOMLocation(getHistoryState());
|
462
|
-
var allKeys = [initialLocation.key]; // Public interface
|
463
|
-
|
464
|
-
function createHref(location) {
|
465
|
-
return basename + createPath(location);
|
466
|
-
}
|
467
|
-
|
468
|
-
function push(path, state) {
|
469
|
-
process.env.NODE_ENV !== "production" ? warning(!(typeof path === 'object' && path.state !== undefined && state !== undefined), 'You should avoid providing a 2nd state argument to push when the 1st ' + 'argument is a location-like object that already has state; it is ignored') : void 0;
|
470
|
-
var action = 'PUSH';
|
471
|
-
var location = createLocation(path, state, createKey(), history.location);
|
472
|
-
transitionManager.confirmTransitionTo(location, action, getUserConfirmation, function (ok) {
|
473
|
-
if (!ok) return;
|
474
|
-
var href = createHref(location);
|
475
|
-
var key = location.key,
|
476
|
-
state = location.state;
|
477
|
-
|
478
|
-
if (canUseHistory) {
|
479
|
-
globalHistory.pushState({
|
480
|
-
key: key,
|
481
|
-
state: state
|
482
|
-
}, null, href);
|
483
|
-
|
484
|
-
if (forceRefresh) {
|
485
|
-
window.location.href = href;
|
486
|
-
} else {
|
487
|
-
var prevIndex = allKeys.indexOf(history.location.key);
|
488
|
-
var nextKeys = allKeys.slice(0, prevIndex + 1);
|
489
|
-
nextKeys.push(location.key);
|
490
|
-
allKeys = nextKeys;
|
491
|
-
setState({
|
492
|
-
action: action,
|
493
|
-
location: location
|
494
|
-
});
|
495
|
-
}
|
496
|
-
} else {
|
497
|
-
process.env.NODE_ENV !== "production" ? warning(state === undefined, 'Browser history cannot push state in browsers that do not support HTML5 history') : void 0;
|
498
|
-
window.location.href = href;
|
499
|
-
}
|
500
|
-
});
|
501
|
-
}
|
502
|
-
|
503
|
-
function replace(path, state) {
|
504
|
-
process.env.NODE_ENV !== "production" ? warning(!(typeof path === 'object' && path.state !== undefined && state !== undefined), 'You should avoid providing a 2nd state argument to replace when the 1st ' + 'argument is a location-like object that already has state; it is ignored') : void 0;
|
505
|
-
var action = 'REPLACE';
|
506
|
-
var location = createLocation(path, state, createKey(), history.location);
|
507
|
-
transitionManager.confirmTransitionTo(location, action, getUserConfirmation, function (ok) {
|
508
|
-
if (!ok) return;
|
509
|
-
var href = createHref(location);
|
510
|
-
var key = location.key,
|
511
|
-
state = location.state;
|
512
|
-
|
513
|
-
if (canUseHistory) {
|
514
|
-
globalHistory.replaceState({
|
515
|
-
key: key,
|
516
|
-
state: state
|
517
|
-
}, null, href);
|
518
|
-
|
519
|
-
if (forceRefresh) {
|
520
|
-
window.location.replace(href);
|
521
|
-
} else {
|
522
|
-
var prevIndex = allKeys.indexOf(history.location.key);
|
523
|
-
if (prevIndex !== -1) allKeys[prevIndex] = location.key;
|
524
|
-
setState({
|
525
|
-
action: action,
|
526
|
-
location: location
|
527
|
-
});
|
528
|
-
}
|
529
|
-
} else {
|
530
|
-
process.env.NODE_ENV !== "production" ? warning(state === undefined, 'Browser history cannot replace state in browsers that do not support HTML5 history') : void 0;
|
531
|
-
window.location.replace(href);
|
532
|
-
}
|
533
|
-
});
|
534
|
-
}
|
535
|
-
|
536
|
-
function go(n) {
|
537
|
-
globalHistory.go(n);
|
538
|
-
}
|
539
|
-
|
540
|
-
function goBack() {
|
541
|
-
go(-1);
|
542
|
-
}
|
543
|
-
|
544
|
-
function goForward() {
|
545
|
-
go(1);
|
546
|
-
}
|
547
|
-
|
548
|
-
var listenerCount = 0;
|
549
|
-
|
550
|
-
function checkDOMListeners(delta) {
|
551
|
-
listenerCount += delta;
|
552
|
-
|
553
|
-
if (listenerCount === 1 && delta === 1) {
|
554
|
-
window.addEventListener(PopStateEvent, handlePopState);
|
555
|
-
if (needsHashChangeListener) window.addEventListener(HashChangeEvent, handleHashChange);
|
556
|
-
} else if (listenerCount === 0) {
|
557
|
-
window.removeEventListener(PopStateEvent, handlePopState);
|
558
|
-
if (needsHashChangeListener) window.removeEventListener(HashChangeEvent, handleHashChange);
|
559
|
-
}
|
560
|
-
}
|
561
|
-
|
562
|
-
var isBlocked = false;
|
563
|
-
|
564
|
-
function block(prompt) {
|
565
|
-
if (prompt === void 0) {
|
566
|
-
prompt = false;
|
567
|
-
}
|
568
|
-
|
569
|
-
var unblock = transitionManager.setPrompt(prompt);
|
570
|
-
|
571
|
-
if (!isBlocked) {
|
572
|
-
checkDOMListeners(1);
|
573
|
-
isBlocked = true;
|
574
|
-
}
|
575
|
-
|
576
|
-
return function () {
|
577
|
-
if (isBlocked) {
|
578
|
-
isBlocked = false;
|
579
|
-
checkDOMListeners(-1);
|
580
|
-
}
|
581
|
-
|
582
|
-
return unblock();
|
583
|
-
};
|
584
|
-
}
|
585
|
-
|
586
|
-
function listen(listener) {
|
587
|
-
var unlisten = transitionManager.appendListener(listener);
|
588
|
-
checkDOMListeners(1);
|
589
|
-
return function () {
|
590
|
-
checkDOMListeners(-1);
|
591
|
-
unlisten();
|
592
|
-
};
|
593
|
-
}
|
594
|
-
|
595
|
-
var history = {
|
596
|
-
length: globalHistory.length,
|
597
|
-
action: 'POP',
|
598
|
-
location: initialLocation,
|
599
|
-
createHref: createHref,
|
600
|
-
push: push,
|
601
|
-
replace: replace,
|
602
|
-
go: go,
|
603
|
-
goBack: goBack,
|
604
|
-
goForward: goForward,
|
605
|
-
block: block,
|
606
|
-
listen: listen
|
607
|
-
};
|
608
|
-
return history;
|
609
|
-
}
|
610
|
-
|
611
21
|
var setLoading = toolkit.createAction("common/setLoading");
|
612
22
|
var setAlert = toolkit.createAction("common/setAlert");
|
613
23
|
var setUser = toolkit.createAction("common/setUser");
|
614
24
|
var setLanguage = toolkit.createAction("common/setLanguage");
|
25
|
+
var reset = toolkit.createAction("common/reset");
|
26
|
+
|
27
|
+
var isLocalHost = Boolean(window.location.hostname === "localhost" || window.location.hostname === "[::1]" || window.location.hostname.match(/^127(?:\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3}$/));
|
615
28
|
|
616
29
|
var GOOGLE_CLIENT_ID = "64118819726-0qlur4qjrs9jbuu6rnoa0u91g680lmpg.apps.googleusercontent.com";
|
617
30
|
var GOOGLE_RECAPTCHA_ID = "6LfNtLUaAAAAAL24lbBV11jS-gBtt1mhtxb4NXs0";
|
618
31
|
var ACCESS_TOKEN = "ACCESS_TOKEN";
|
619
32
|
var DATE_MIN_VALUE = "0001-01-01T00:00:00+00:00";
|
620
|
-
var BASE_URL =
|
33
|
+
var BASE_URL = function () {
|
34
|
+
return isLocalHost ? "https://localhost:7045" : "api.studypeak.io";
|
35
|
+
}();
|
621
36
|
var PUSHER_CONFIG = {
|
622
37
|
cluster: "ap1",
|
623
38
|
key: "9018c77328885a14150b"
|
@@ -733,17 +148,37 @@ var AuthenticationMessage;
|
|
733
148
|
})(AuthenticationMessage || (AuthenticationMessage = {}));
|
734
149
|
|
735
150
|
var useGoogleSignOut = function useGoogleSignOut(props) {
|
151
|
+
var dispatch = reactRedux.useDispatch();
|
736
152
|
var onLogoutSuccess = props.onLogoutSuccess,
|
737
153
|
onFailure = props.onFailure;
|
154
|
+
var handleLogoutSuccess = function handleLogoutSuccess() {
|
155
|
+
onLogoutSuccess === null || onLogoutSuccess === void 0 ? void 0 : onLogoutSuccess();
|
156
|
+
};
|
157
|
+
var handleLogoutFailure = function handleLogoutFailure() {
|
158
|
+
onFailure === null || onFailure === void 0 ? void 0 : onFailure();
|
159
|
+
};
|
738
160
|
var _useGoogleLogout = GoogleLogin.useGoogleLogout({
|
739
161
|
clientId: GOOGLE_CLIENT_ID,
|
740
|
-
onLogoutSuccess:
|
741
|
-
onFailure:
|
162
|
+
onLogoutSuccess: handleLogoutSuccess,
|
163
|
+
onFailure: handleLogoutFailure
|
742
164
|
}),
|
743
165
|
signOut = _useGoogleLogout.signOut,
|
744
166
|
loaded = _useGoogleLogout.loaded;
|
167
|
+
var handleSignOut = function handleSignOut() {
|
168
|
+
localStorage.removeItem("USER_INFORMATION");
|
169
|
+
localStorage.removeItem(ACCESS_TOKEN);
|
170
|
+
try {
|
171
|
+
signOut();
|
172
|
+
} catch (error) {
|
173
|
+
console.log({
|
174
|
+
error: error
|
175
|
+
});
|
176
|
+
}
|
177
|
+
dispatch(reset());
|
178
|
+
window.location.href = "/login";
|
179
|
+
};
|
745
180
|
return {
|
746
|
-
|
181
|
+
handleSignOut: handleSignOut,
|
747
182
|
loaded: loaded
|
748
183
|
};
|
749
184
|
};
|
@@ -762,14 +197,23 @@ var BlockLogin = function BlockLogin(_ref) {
|
|
762
197
|
var _useGoogleReCaptcha = reactGoogleRecaptchaV3.useGoogleReCaptcha(),
|
763
198
|
executeRecaptcha = _useGoogleReCaptcha.executeRecaptcha;
|
764
199
|
var _useGoogleSignOut = useGoogleSignOut({}),
|
765
|
-
|
200
|
+
handleSignOut = _useGoogleSignOut.handleSignOut;
|
766
201
|
var clickHandler = React.useCallback(function () {
|
767
202
|
try {
|
203
|
+
var _exit = false;
|
768
204
|
if (!executeRecaptcha) {
|
769
|
-
console.log("execute recaptcha undefined");
|
770
205
|
return Promise.resolve();
|
771
206
|
}
|
772
|
-
return Promise.resolve(
|
207
|
+
return Promise.resolve(_catch(function () {
|
208
|
+
return Promise.resolve(executeRecaptcha("login")).then(function (result) {
|
209
|
+
_exit = true;
|
210
|
+
return result;
|
211
|
+
});
|
212
|
+
}, function (error) {
|
213
|
+
console.log({
|
214
|
+
error: error
|
215
|
+
});
|
216
|
+
}));
|
773
217
|
} catch (e) {
|
774
218
|
return Promise.reject(e);
|
775
219
|
}
|
@@ -777,65 +221,59 @@ var BlockLogin = function BlockLogin(_ref) {
|
|
777
221
|
var handleVerify = React.useCallback(function () {}, []);
|
778
222
|
var onSuccessGoogle = function onSuccessGoogle(res) {
|
779
223
|
try {
|
780
|
-
var _exit = false;
|
781
224
|
return Promise.resolve(function () {
|
782
225
|
if (!!(res !== null && res !== void 0 && res.accessToken)) {
|
783
|
-
var _temp2 = function _temp2(_result) {
|
784
|
-
if (_exit) return _result;
|
785
|
-
dispatch(setLoading(false));
|
786
|
-
};
|
787
226
|
var _res$profileObj = res.profileObj,
|
788
227
|
email = _res$profileObj.email,
|
789
228
|
imageUrl = _res$profileObj.imageUrl,
|
790
229
|
name = _res$profileObj.name;
|
791
230
|
var accessToken = res.tokenObj.id_token;
|
792
231
|
var googleId = res.googleId;
|
793
|
-
|
794
|
-
|
795
|
-
|
796
|
-
|
797
|
-
|
798
|
-
|
799
|
-
|
800
|
-
|
801
|
-
|
802
|
-
|
803
|
-
|
804
|
-
|
805
|
-
|
806
|
-
|
807
|
-
|
808
|
-
|
809
|
-
|
810
|
-
|
811
|
-
|
812
|
-
|
813
|
-
|
814
|
-
|
232
|
+
return Promise.resolve(clickHandler()).then(function (clickHandlerRes) {
|
233
|
+
function _temp2() {
|
234
|
+
dispatch(setLoading(false));
|
235
|
+
}
|
236
|
+
if (!clickHandlerRes) return;
|
237
|
+
var infoLogin = {
|
238
|
+
imageUrl: imageUrl,
|
239
|
+
fullName: name,
|
240
|
+
email: email,
|
241
|
+
token: accessToken,
|
242
|
+
googleId: googleId,
|
243
|
+
captcha: clickHandlerRes
|
244
|
+
};
|
245
|
+
var role = isTeacher ? "Teacher" : "Student";
|
246
|
+
dispatch(setLoading(true));
|
247
|
+
var _temp = _catch(function () {
|
248
|
+
return Promise.resolve(apiLoginGoogle(infoLogin, role)).then(function (res1) {
|
249
|
+
var isFirstLogin = res1.data.isFirstLogin;
|
250
|
+
var tokenJWT = res1.data.token;
|
251
|
+
localStorage.setItem("USER_INFORMATION", JSON.stringify(infoLogin));
|
252
|
+
localStorage.setItem(ACCESS_TOKEN, tokenJWT);
|
253
|
+
if (!isTeacher && isFirstLogin) {
|
254
|
+
onNavigate("/register/info");
|
255
|
+
} else {
|
256
|
+
onNavigate("/");
|
257
|
+
}
|
258
|
+
});
|
259
|
+
}, function (error) {
|
260
|
+
var _error$response, _error$response$data;
|
261
|
+
var message = undefined;
|
262
|
+
var type = error === null || error === void 0 ? void 0 : (_error$response = error.response) === null || _error$response === void 0 ? void 0 : (_error$response$data = _error$response.data) === null || _error$response$data === void 0 ? void 0 : _error$response$data.type;
|
263
|
+
if (type === AuthenticationMessage.NotAllowedToRegister) {
|
264
|
+
alert("가입 권한이 없는 계정입니다. 관리자에게 문의하세요.");
|
265
|
+
} else if (type) {
|
266
|
+
var _error$response2, _error$response2$data;
|
267
|
+
message = (error === null || error === void 0 ? void 0 : (_error$response2 = error.response) === null || _error$response2 === void 0 ? void 0 : (_error$response2$data = _error$response2.data) === null || _error$response2$data === void 0 ? void 0 : _error$response2$data.message) || ERROR_MESSAGE;
|
815
268
|
} else {
|
816
|
-
|
269
|
+
var _error$response3;
|
270
|
+
message = (error === null || error === void 0 ? void 0 : (_error$response3 = error.response) === null || _error$response3 === void 0 ? void 0 : _error$response3.data) || ERROR_MESSAGE;
|
817
271
|
}
|
272
|
+
message && alert(message);
|
273
|
+
handleSignOut();
|
818
274
|
});
|
819
|
-
|
820
|
-
var _error$response, _error$response$data;
|
821
|
-
var message = undefined;
|
822
|
-
var type = error === null || error === void 0 ? void 0 : (_error$response = error.response) === null || _error$response === void 0 ? void 0 : (_error$response$data = _error$response.data) === null || _error$response$data === void 0 ? void 0 : _error$response$data.type;
|
823
|
-
if (type === AuthenticationMessage.NotAllowedToRegister) {
|
824
|
-
alert("가입 권한이 없는 계정입니다. 관리자에게 문의하세요.");
|
825
|
-
} else if (type) {
|
826
|
-
var _error$response2, _error$response2$data;
|
827
|
-
message = (error === null || error === void 0 ? void 0 : (_error$response2 = error.response) === null || _error$response2 === void 0 ? void 0 : (_error$response2$data = _error$response2.data) === null || _error$response2$data === void 0 ? void 0 : _error$response2$data.message) || ERROR_MESSAGE;
|
828
|
-
} else {
|
829
|
-
var _error$response3;
|
830
|
-
message = (error === null || error === void 0 ? void 0 : (_error$response3 = error.response) === null || _error$response3 === void 0 ? void 0 : _error$response3.data) || ERROR_MESSAGE;
|
831
|
-
}
|
832
|
-
signOut();
|
833
|
-
!!message && dispatch(setAlert({
|
834
|
-
type: "danger",
|
835
|
-
message: message
|
836
|
-
}));
|
275
|
+
return _temp && _temp.then ? _temp.then(_temp2) : _temp2(_temp);
|
837
276
|
});
|
838
|
-
return _temp && _temp.then ? _temp.then(_temp2) : _temp2(_temp);
|
839
277
|
}
|
840
278
|
}());
|
841
279
|
} catch (e) {
|
@@ -851,14 +289,10 @@ var BlockLogin = function BlockLogin(_ref) {
|
|
851
289
|
validationSchema: schema,
|
852
290
|
onSubmit: function (values) {
|
853
291
|
try {
|
854
|
-
return Promise.resolve(
|
855
|
-
|
856
|
-
|
857
|
-
|
858
|
-
});
|
859
|
-
}, function (err) {
|
860
|
-
console.error(err);
|
861
|
-
}));
|
292
|
+
return Promise.resolve(clickHandler()).then(function (clickHandlerRes) {
|
293
|
+
if (!clickHandlerRes) return;
|
294
|
+
values.captcha = clickHandlerRes;
|
295
|
+
});
|
862
296
|
} catch (e) {
|
863
297
|
return Promise.reject(e);
|
864
298
|
}
|
@@ -894,13 +328,21 @@ var BlockLogin = function BlockLogin(_ref) {
|
|
894
328
|
});
|
895
329
|
};
|
896
330
|
|
331
|
+
var getAccessToken$1 = (function () {
|
332
|
+
try {
|
333
|
+
return localStorage.getItem(ACCESS_TOKEN);
|
334
|
+
} catch (err) {
|
335
|
+
return null;
|
336
|
+
}
|
337
|
+
});
|
338
|
+
|
897
339
|
var defaultInfo = {
|
898
340
|
email: "",
|
899
341
|
password: "",
|
900
342
|
captcha: "",
|
901
343
|
rememberMe: false
|
902
344
|
};
|
903
|
-
var useLogin = function useLogin() {
|
345
|
+
var useLogin = function useLogin(onNavigate) {
|
904
346
|
var _useState = React.useState(false),
|
905
347
|
openLogin = _useState[0],
|
906
348
|
setOpenLogin = _useState[1];
|
@@ -920,7 +362,11 @@ var useLogin = function useLogin() {
|
|
920
362
|
scope: 'email'
|
921
363
|
});
|
922
364
|
};
|
923
|
-
gapiScript.gapi.load('client:auth2', start);
|
365
|
+
!!gapiScript.gapi && gapiScript.gapi.load('client:auth2', start);
|
366
|
+
}, [gapiScript.gapi]);
|
367
|
+
React.useEffect(function () {
|
368
|
+
var token = getAccessToken$1();
|
369
|
+
if (!!token) onNavigate("/");
|
924
370
|
}, []);
|
925
371
|
return {
|
926
372
|
defaultInfo: defaultInfo,
|
@@ -936,7 +382,7 @@ var useLogin = function useLogin() {
|
|
936
382
|
var Login = function Login(_ref) {
|
937
383
|
var onNavigate = _ref.onNavigate,
|
938
384
|
isTeacher = _ref.isTeacher;
|
939
|
-
var _useLogin = useLogin(),
|
385
|
+
var _useLogin = useLogin(onNavigate),
|
940
386
|
defaultInfo = _useLogin.defaultInfo;
|
941
387
|
return React__default.createElement("div", {
|
942
388
|
className: styles["login"] + " container-fluid font-family-lato"
|
@@ -1057,7 +503,7 @@ function kindOf(val) {
|
|
1057
503
|
}
|
1058
504
|
|
1059
505
|
// src/utils/warning.ts
|
1060
|
-
function warning
|
506
|
+
function warning(message) {
|
1061
507
|
if (typeof console !== "undefined" && typeof console.error === "function") {
|
1062
508
|
console.error(message);
|
1063
509
|
}
|
@@ -1110,7 +556,7 @@ function combineReducers(reducers) {
|
|
1110
556
|
const key = reducerKeys[i];
|
1111
557
|
if (process.env.NODE_ENV !== "production") {
|
1112
558
|
if (typeof reducers[key] === "undefined") {
|
1113
|
-
warning
|
559
|
+
warning(`No reducer provided for key "${key}"`);
|
1114
560
|
}
|
1115
561
|
}
|
1116
562
|
if (typeof reducers[key] === "function") {
|
@@ -1135,7 +581,7 @@ function combineReducers(reducers) {
|
|
1135
581
|
if (process.env.NODE_ENV !== "production") {
|
1136
582
|
const warningMessage = getUnexpectedStateShapeWarningMessage(state, finalReducers, action, unexpectedKeyCache);
|
1137
583
|
if (warningMessage) {
|
1138
|
-
warning
|
584
|
+
warning(warningMessage);
|
1139
585
|
}
|
1140
586
|
}
|
1141
587
|
let hasChanged = false;
|
@@ -1174,6 +620,8 @@ var commonReducer = toolkit.createReducer(initialState, function (builder) {
|
|
1174
620
|
state.user = action.payload;
|
1175
621
|
}).addCase(setLanguage, function (state, action) {
|
1176
622
|
state.language = action.payload;
|
623
|
+
}).addCase(reset, function (_state, _action) {
|
624
|
+
return initialState;
|
1177
625
|
});
|
1178
626
|
});
|
1179
627
|
|
@@ -1250,14 +698,6 @@ var encodeParams$1 = (function (params) {
|
|
1250
698
|
}).join('&');
|
1251
699
|
});
|
1252
700
|
|
1253
|
-
var getAccessToken$1 = (function () {
|
1254
|
-
try {
|
1255
|
-
return localStorage.getItem(ACCESS_TOKEN);
|
1256
|
-
} catch (err) {
|
1257
|
-
return null;
|
1258
|
-
}
|
1259
|
-
});
|
1260
|
-
|
1261
701
|
var api$1 = axios.create({
|
1262
702
|
baseURL: BASE_URL,
|
1263
703
|
timeout: 0,
|
@@ -1309,15 +749,28 @@ var getInfo = function getInfo() {
|
|
1309
749
|
|
1310
750
|
var LayoutContext = function LayoutContext(_ref) {
|
1311
751
|
var children = _ref.children,
|
1312
|
-
|
752
|
+
role = _ref.role;
|
1313
753
|
var _useGoogleSignOut = useGoogleSignOut({}),
|
1314
|
-
|
754
|
+
handleSignOut = _useGoogleSignOut.handleSignOut;
|
1315
755
|
var dispatch = reactRedux.useDispatch();
|
756
|
+
var user = reactRedux.useSelector(function (state) {
|
757
|
+
var _state$common;
|
758
|
+
return state === null || state === void 0 ? void 0 : (_state$common = state.common) === null || _state$common === void 0 ? void 0 : _state$common.user;
|
759
|
+
});
|
1316
760
|
var resetAuth = function resetAuth() {
|
1317
|
-
|
1318
|
-
signOut();
|
1319
|
-
onNavigate("/login");
|
761
|
+
handleSignOut();
|
1320
762
|
};
|
763
|
+
var checkRoleUser = React.useCallback(function () {
|
764
|
+
var _user$roles, _user$roles2;
|
765
|
+
if (!user) return;
|
766
|
+
var isAdmin = (_user$roles = user.roles) === null || _user$roles === void 0 ? void 0 : _user$roles.includes("Admin");
|
767
|
+
if (isAdmin && role !== "Teacher") alert(user.email + " not allow to register " + role);
|
768
|
+
if (isAdmin) return;
|
769
|
+
if (!((_user$roles2 = user.roles) !== null && _user$roles2 !== void 0 && _user$roles2.includes(role))) {
|
770
|
+
alert(user.email + " not allow to register " + role);
|
771
|
+
resetAuth();
|
772
|
+
}
|
773
|
+
}, [role, JSON.stringify(user)]);
|
1321
774
|
var loadInfo = function loadInfo() {
|
1322
775
|
try {
|
1323
776
|
var _temp2 = function _temp2() {
|
@@ -1336,7 +789,11 @@ var LayoutContext = function LayoutContext(_ref) {
|
|
1336
789
|
}
|
1337
790
|
dispatch(setUser(info.data));
|
1338
791
|
});
|
1339
|
-
}, function () {
|
792
|
+
}, function (err) {
|
793
|
+
console.log({
|
794
|
+
err: err
|
795
|
+
});
|
796
|
+
role === "Student" ? alert("학생, 다시 로그인해주세요.") : alert("선생님, 다시 로그인해주세요.");
|
1340
797
|
resetAuth();
|
1341
798
|
});
|
1342
799
|
return Promise.resolve(_temp && _temp.then ? _temp.then(_temp2) : _temp2(_temp));
|
@@ -1345,8 +802,9 @@ var LayoutContext = function LayoutContext(_ref) {
|
|
1345
802
|
}
|
1346
803
|
};
|
1347
804
|
React.useEffect(function () {
|
1348
|
-
loadInfo();
|
1349
|
-
|
805
|
+
!user && loadInfo();
|
806
|
+
!!user && checkRoleUser();
|
807
|
+
}, [JSON.stringify(user)]);
|
1350
808
|
return React__default.createElement(React.Fragment, null, children);
|
1351
809
|
};
|
1352
810
|
|
@@ -1562,6 +1020,7 @@ var description_success = "스터디 터치는 엄태욱 선생님의 수업에
|
|
1562
1020
|
var logout = "로그 아웃";
|
1563
1021
|
var overall_status = "전체 현황";
|
1564
1022
|
var exam_status = "시험별 현";
|
1023
|
+
var student_status = "학생 신분";
|
1565
1024
|
var user_manager = "사용자 목록";
|
1566
1025
|
var recent_exam_results = "최근 시험 결과";
|
1567
1026
|
var instructor_name = "강사이름";
|
@@ -1606,6 +1065,7 @@ var no_data = "데이터 없음";
|
|
1606
1065
|
var internet_connection_was_lost = "인터넷 연결이 끊어졌습니다";
|
1607
1066
|
var problem = "문제";
|
1608
1067
|
var problem_solving_time = "문제풀이 시간";
|
1068
|
+
var minutes = "분";
|
1609
1069
|
var lang_ko = {
|
1610
1070
|
problem_solving: problem_solving,
|
1611
1071
|
my_story: my_story,
|
@@ -1617,6 +1077,7 @@ var lang_ko = {
|
|
1617
1077
|
logout: logout,
|
1618
1078
|
overall_status: overall_status,
|
1619
1079
|
exam_status: exam_status,
|
1080
|
+
student_status: student_status,
|
1620
1081
|
user_manager: user_manager,
|
1621
1082
|
recent_exam_results: recent_exam_results,
|
1622
1083
|
instructor_name: instructor_name,
|
@@ -1660,7 +1121,8 @@ var lang_ko = {
|
|
1660
1121
|
no_data: no_data,
|
1661
1122
|
internet_connection_was_lost: internet_connection_was_lost,
|
1662
1123
|
problem: problem,
|
1663
|
-
problem_solving_time: problem_solving_time
|
1124
|
+
problem_solving_time: problem_solving_time,
|
1125
|
+
minutes: minutes
|
1664
1126
|
};
|
1665
1127
|
|
1666
1128
|
var problem_solving$1 = "Problem Solving";
|
@@ -1673,6 +1135,7 @@ var description_success$1 = "Study Touch is a learning tool used in teacher Taew
|
|
1673
1135
|
var logout$1 = "Logout";
|
1674
1136
|
var overall_status$1 = "Overall Status";
|
1675
1137
|
var exam_status$1 = "Exam Status";
|
1138
|
+
var student_status$1 = "Student Status";
|
1676
1139
|
var user_manager$1 = "User Manager";
|
1677
1140
|
var recent_exam_results$1 = "Recent exam";
|
1678
1141
|
var instructor_name$1 = "Instructor name";
|
@@ -1717,6 +1180,7 @@ var no_data$1 = "No data";
|
|
1717
1180
|
var internet_connection_was_lost$1 = "Internet connection was lost";
|
1718
1181
|
var problem$1 = "Problem ";
|
1719
1182
|
var problem_solving_time$1 = "Problem solving time";
|
1183
|
+
var minutes$1 = "m";
|
1720
1184
|
var lang_en = {
|
1721
1185
|
problem_solving: problem_solving$1,
|
1722
1186
|
my_story: my_story$1,
|
@@ -1728,6 +1192,7 @@ var lang_en = {
|
|
1728
1192
|
logout: logout$1,
|
1729
1193
|
overall_status: overall_status$1,
|
1730
1194
|
exam_status: exam_status$1,
|
1195
|
+
student_status: student_status$1,
|
1731
1196
|
user_manager: user_manager$1,
|
1732
1197
|
recent_exam_results: recent_exam_results$1,
|
1733
1198
|
instructor_name: instructor_name$1,
|
@@ -1771,7 +1236,8 @@ var lang_en = {
|
|
1771
1236
|
no_data: no_data$1,
|
1772
1237
|
internet_connection_was_lost: internet_connection_was_lost$1,
|
1773
1238
|
problem: problem$1,
|
1774
|
-
problem_solving_time: problem_solving_time$1
|
1239
|
+
problem_solving_time: problem_solving_time$1,
|
1240
|
+
minutes: minutes$1
|
1775
1241
|
};
|
1776
1242
|
|
1777
1243
|
i18n.use(reactI18next.initReactI18next).init({
|
@@ -1903,19 +1369,32 @@ var toISOString = (function (time) {
|
|
1903
1369
|
}
|
1904
1370
|
});
|
1905
1371
|
|
1906
|
-
var
|
1372
|
+
var canAccess = function canAccess(userRoles, componentRoles) {
|
1373
|
+
if (!Array.isArray(userRoles)) {
|
1374
|
+
return false;
|
1375
|
+
}
|
1376
|
+
if (Array.isArray(componentRoles)) {
|
1377
|
+
var intersects = userRoles.filter(function (i) {
|
1378
|
+
return componentRoles.includes(i);
|
1379
|
+
});
|
1380
|
+
return intersects.length > 0;
|
1381
|
+
}
|
1382
|
+
return true;
|
1383
|
+
};
|
1384
|
+
|
1385
|
+
var historyCore = history.createBrowserHistory();
|
1907
1386
|
|
1908
1387
|
Object.defineProperty(exports, 'I18nextProvider', {
|
1909
|
-
|
1910
|
-
|
1911
|
-
|
1912
|
-
|
1388
|
+
enumerable: true,
|
1389
|
+
get: function () {
|
1390
|
+
return reactI18next.I18nextProvider;
|
1391
|
+
}
|
1913
1392
|
});
|
1914
1393
|
Object.defineProperty(exports, 'useTranslation', {
|
1915
|
-
|
1916
|
-
|
1917
|
-
|
1918
|
-
|
1394
|
+
enumerable: true,
|
1395
|
+
get: function () {
|
1396
|
+
return reactI18next.useTranslation;
|
1397
|
+
}
|
1919
1398
|
});
|
1920
1399
|
exports.ACCESS_TOKEN = ACCESS_TOKEN;
|
1921
1400
|
exports.BASE_URL = BASE_URL;
|
@@ -1932,6 +1411,7 @@ exports.NotFound = NotFound;
|
|
1932
1411
|
exports.PUSHER_CONFIG = PUSHER_CONFIG;
|
1933
1412
|
exports.TheLanguageDropdown = TheLanguageDropdown;
|
1934
1413
|
exports.api = api$1;
|
1414
|
+
exports.canAccessRoute = canAccess;
|
1935
1415
|
exports.diffFromNow = diffFromNow;
|
1936
1416
|
exports.formatTime = formatTime;
|
1937
1417
|
exports.historyCore = historyCore;
|