touchstudy-core 0.1.3 → 0.1.4
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 +153 -677
- package/dist/index.js.map +1 -1
- package/dist/index.modern.js +152 -677
- 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/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,601 +18,11 @@ 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");
|
615
26
|
|
616
27
|
var GOOGLE_CLIENT_ID = "64118819726-0qlur4qjrs9jbuu6rnoa0u91g680lmpg.apps.googleusercontent.com";
|
617
28
|
var GOOGLE_RECAPTCHA_ID = "6LfNtLUaAAAAAL24lbBV11jS-gBtt1mhtxb4NXs0";
|
@@ -733,17 +144,37 @@ var AuthenticationMessage;
|
|
733
144
|
})(AuthenticationMessage || (AuthenticationMessage = {}));
|
734
145
|
|
735
146
|
var useGoogleSignOut = function useGoogleSignOut(props) {
|
147
|
+
var dispatch = reactRedux.useDispatch();
|
736
148
|
var onLogoutSuccess = props.onLogoutSuccess,
|
737
149
|
onFailure = props.onFailure;
|
150
|
+
var handleLogoutSuccess = function handleLogoutSuccess() {
|
151
|
+
onLogoutSuccess === null || onLogoutSuccess === void 0 ? void 0 : onLogoutSuccess();
|
152
|
+
};
|
153
|
+
var handleLogoutFailure = function handleLogoutFailure() {
|
154
|
+
onFailure === null || onFailure === void 0 ? void 0 : onFailure();
|
155
|
+
};
|
738
156
|
var _useGoogleLogout = GoogleLogin.useGoogleLogout({
|
739
157
|
clientId: GOOGLE_CLIENT_ID,
|
740
|
-
onLogoutSuccess:
|
741
|
-
onFailure:
|
158
|
+
onLogoutSuccess: handleLogoutSuccess,
|
159
|
+
onFailure: handleLogoutFailure
|
742
160
|
}),
|
743
161
|
signOut = _useGoogleLogout.signOut,
|
744
162
|
loaded = _useGoogleLogout.loaded;
|
163
|
+
var handleSignOut = function handleSignOut() {
|
164
|
+
localStorage.removeItem("USER_INFORMATION");
|
165
|
+
localStorage.removeItem(ACCESS_TOKEN);
|
166
|
+
try {
|
167
|
+
signOut();
|
168
|
+
} catch (error) {
|
169
|
+
console.log({
|
170
|
+
error: error
|
171
|
+
});
|
172
|
+
}
|
173
|
+
dispatch(reset());
|
174
|
+
window.location.href = "/login";
|
175
|
+
};
|
745
176
|
return {
|
746
|
-
|
177
|
+
handleSignOut: handleSignOut,
|
747
178
|
loaded: loaded
|
748
179
|
};
|
749
180
|
};
|
@@ -762,14 +193,23 @@ var BlockLogin = function BlockLogin(_ref) {
|
|
762
193
|
var _useGoogleReCaptcha = reactGoogleRecaptchaV3.useGoogleReCaptcha(),
|
763
194
|
executeRecaptcha = _useGoogleReCaptcha.executeRecaptcha;
|
764
195
|
var _useGoogleSignOut = useGoogleSignOut({}),
|
765
|
-
|
196
|
+
handleSignOut = _useGoogleSignOut.handleSignOut;
|
766
197
|
var clickHandler = React.useCallback(function () {
|
767
198
|
try {
|
199
|
+
var _exit = false;
|
768
200
|
if (!executeRecaptcha) {
|
769
|
-
console.log("execute recaptcha undefined");
|
770
201
|
return Promise.resolve();
|
771
202
|
}
|
772
|
-
return Promise.resolve(
|
203
|
+
return Promise.resolve(_catch(function () {
|
204
|
+
return Promise.resolve(executeRecaptcha("login")).then(function (result) {
|
205
|
+
_exit = true;
|
206
|
+
return result;
|
207
|
+
});
|
208
|
+
}, function (error) {
|
209
|
+
console.log({
|
210
|
+
error: error
|
211
|
+
});
|
212
|
+
}));
|
773
213
|
} catch (e) {
|
774
214
|
return Promise.reject(e);
|
775
215
|
}
|
@@ -777,65 +217,59 @@ var BlockLogin = function BlockLogin(_ref) {
|
|
777
217
|
var handleVerify = React.useCallback(function () {}, []);
|
778
218
|
var onSuccessGoogle = function onSuccessGoogle(res) {
|
779
219
|
try {
|
780
|
-
var _exit = false;
|
781
220
|
return Promise.resolve(function () {
|
782
221
|
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
222
|
var _res$profileObj = res.profileObj,
|
788
223
|
email = _res$profileObj.email,
|
789
224
|
imageUrl = _res$profileObj.imageUrl,
|
790
225
|
name = _res$profileObj.name;
|
791
226
|
var accessToken = res.tokenObj.id_token;
|
792
227
|
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
|
-
|
228
|
+
return Promise.resolve(clickHandler()).then(function (clickHandlerRes) {
|
229
|
+
function _temp2() {
|
230
|
+
dispatch(setLoading(false));
|
231
|
+
}
|
232
|
+
if (!clickHandlerRes) return;
|
233
|
+
var infoLogin = {
|
234
|
+
imageUrl: imageUrl,
|
235
|
+
fullName: name,
|
236
|
+
email: email,
|
237
|
+
token: accessToken,
|
238
|
+
googleId: googleId,
|
239
|
+
captcha: clickHandlerRes
|
240
|
+
};
|
241
|
+
var role = isTeacher ? "Teacher" : "Student";
|
242
|
+
dispatch(setLoading(true));
|
243
|
+
var _temp = _catch(function () {
|
244
|
+
return Promise.resolve(apiLoginGoogle(infoLogin, role)).then(function (res1) {
|
245
|
+
var isFirstLogin = res1.data.isFirstLogin;
|
246
|
+
var tokenJWT = res1.data.token;
|
247
|
+
localStorage.setItem("USER_INFORMATION", JSON.stringify(infoLogin));
|
248
|
+
localStorage.setItem(ACCESS_TOKEN, tokenJWT);
|
249
|
+
if (!isTeacher && isFirstLogin) {
|
250
|
+
onNavigate("/register/info");
|
251
|
+
} else {
|
252
|
+
onNavigate("/");
|
253
|
+
}
|
254
|
+
});
|
255
|
+
}, function (error) {
|
256
|
+
var _error$response, _error$response$data;
|
257
|
+
var message = undefined;
|
258
|
+
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;
|
259
|
+
if (type === AuthenticationMessage.NotAllowedToRegister) {
|
260
|
+
alert("가입 권한이 없는 계정입니다. 관리자에게 문의하세요.");
|
261
|
+
} else if (type) {
|
262
|
+
var _error$response2, _error$response2$data;
|
263
|
+
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
264
|
} else {
|
816
|
-
|
265
|
+
var _error$response3;
|
266
|
+
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
267
|
}
|
268
|
+
message && alert(message);
|
269
|
+
handleSignOut();
|
818
270
|
});
|
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
|
-
}));
|
271
|
+
return _temp && _temp.then ? _temp.then(_temp2) : _temp2(_temp);
|
837
272
|
});
|
838
|
-
return _temp && _temp.then ? _temp.then(_temp2) : _temp2(_temp);
|
839
273
|
}
|
840
274
|
}());
|
841
275
|
} catch (e) {
|
@@ -851,14 +285,10 @@ var BlockLogin = function BlockLogin(_ref) {
|
|
851
285
|
validationSchema: schema,
|
852
286
|
onSubmit: function (values) {
|
853
287
|
try {
|
854
|
-
return Promise.resolve(
|
855
|
-
|
856
|
-
|
857
|
-
|
858
|
-
});
|
859
|
-
}, function (err) {
|
860
|
-
console.error(err);
|
861
|
-
}));
|
288
|
+
return Promise.resolve(clickHandler()).then(function (clickHandlerRes) {
|
289
|
+
if (!clickHandlerRes) return;
|
290
|
+
values.captcha = clickHandlerRes;
|
291
|
+
});
|
862
292
|
} catch (e) {
|
863
293
|
return Promise.reject(e);
|
864
294
|
}
|
@@ -894,13 +324,21 @@ var BlockLogin = function BlockLogin(_ref) {
|
|
894
324
|
});
|
895
325
|
};
|
896
326
|
|
327
|
+
var getAccessToken$1 = (function () {
|
328
|
+
try {
|
329
|
+
return localStorage.getItem(ACCESS_TOKEN);
|
330
|
+
} catch (err) {
|
331
|
+
return null;
|
332
|
+
}
|
333
|
+
});
|
334
|
+
|
897
335
|
var defaultInfo = {
|
898
336
|
email: "",
|
899
337
|
password: "",
|
900
338
|
captcha: "",
|
901
339
|
rememberMe: false
|
902
340
|
};
|
903
|
-
var useLogin = function useLogin() {
|
341
|
+
var useLogin = function useLogin(onNavigate) {
|
904
342
|
var _useState = React.useState(false),
|
905
343
|
openLogin = _useState[0],
|
906
344
|
setOpenLogin = _useState[1];
|
@@ -920,7 +358,11 @@ var useLogin = function useLogin() {
|
|
920
358
|
scope: 'email'
|
921
359
|
});
|
922
360
|
};
|
923
|
-
gapiScript.gapi.load('client:auth2', start);
|
361
|
+
!!gapiScript.gapi && gapiScript.gapi.load('client:auth2', start);
|
362
|
+
}, [gapiScript.gapi]);
|
363
|
+
React.useEffect(function () {
|
364
|
+
var token = getAccessToken$1();
|
365
|
+
if (!!token) onNavigate("/");
|
924
366
|
}, []);
|
925
367
|
return {
|
926
368
|
defaultInfo: defaultInfo,
|
@@ -936,7 +378,7 @@ var useLogin = function useLogin() {
|
|
936
378
|
var Login = function Login(_ref) {
|
937
379
|
var onNavigate = _ref.onNavigate,
|
938
380
|
isTeacher = _ref.isTeacher;
|
939
|
-
var _useLogin = useLogin(),
|
381
|
+
var _useLogin = useLogin(onNavigate),
|
940
382
|
defaultInfo = _useLogin.defaultInfo;
|
941
383
|
return React__default.createElement("div", {
|
942
384
|
className: styles["login"] + " container-fluid font-family-lato"
|
@@ -1057,7 +499,7 @@ function kindOf(val) {
|
|
1057
499
|
}
|
1058
500
|
|
1059
501
|
// src/utils/warning.ts
|
1060
|
-
function warning
|
502
|
+
function warning(message) {
|
1061
503
|
if (typeof console !== "undefined" && typeof console.error === "function") {
|
1062
504
|
console.error(message);
|
1063
505
|
}
|
@@ -1110,7 +552,7 @@ function combineReducers(reducers) {
|
|
1110
552
|
const key = reducerKeys[i];
|
1111
553
|
if (process.env.NODE_ENV !== "production") {
|
1112
554
|
if (typeof reducers[key] === "undefined") {
|
1113
|
-
warning
|
555
|
+
warning(`No reducer provided for key "${key}"`);
|
1114
556
|
}
|
1115
557
|
}
|
1116
558
|
if (typeof reducers[key] === "function") {
|
@@ -1135,7 +577,7 @@ function combineReducers(reducers) {
|
|
1135
577
|
if (process.env.NODE_ENV !== "production") {
|
1136
578
|
const warningMessage = getUnexpectedStateShapeWarningMessage(state, finalReducers, action, unexpectedKeyCache);
|
1137
579
|
if (warningMessage) {
|
1138
|
-
warning
|
580
|
+
warning(warningMessage);
|
1139
581
|
}
|
1140
582
|
}
|
1141
583
|
let hasChanged = false;
|
@@ -1174,6 +616,8 @@ var commonReducer = toolkit.createReducer(initialState, function (builder) {
|
|
1174
616
|
state.user = action.payload;
|
1175
617
|
}).addCase(setLanguage, function (state, action) {
|
1176
618
|
state.language = action.payload;
|
619
|
+
}).addCase(reset, function (_state, _action) {
|
620
|
+
return initialState;
|
1177
621
|
});
|
1178
622
|
});
|
1179
623
|
|
@@ -1250,14 +694,6 @@ var encodeParams$1 = (function (params) {
|
|
1250
694
|
}).join('&');
|
1251
695
|
});
|
1252
696
|
|
1253
|
-
var getAccessToken$1 = (function () {
|
1254
|
-
try {
|
1255
|
-
return localStorage.getItem(ACCESS_TOKEN);
|
1256
|
-
} catch (err) {
|
1257
|
-
return null;
|
1258
|
-
}
|
1259
|
-
});
|
1260
|
-
|
1261
697
|
var api$1 = axios.create({
|
1262
698
|
baseURL: BASE_URL,
|
1263
699
|
timeout: 0,
|
@@ -1309,15 +745,28 @@ var getInfo = function getInfo() {
|
|
1309
745
|
|
1310
746
|
var LayoutContext = function LayoutContext(_ref) {
|
1311
747
|
var children = _ref.children,
|
1312
|
-
|
748
|
+
role = _ref.role;
|
1313
749
|
var _useGoogleSignOut = useGoogleSignOut({}),
|
1314
|
-
|
750
|
+
handleSignOut = _useGoogleSignOut.handleSignOut;
|
1315
751
|
var dispatch = reactRedux.useDispatch();
|
752
|
+
var user = reactRedux.useSelector(function (state) {
|
753
|
+
var _state$common;
|
754
|
+
return state === null || state === void 0 ? void 0 : (_state$common = state.common) === null || _state$common === void 0 ? void 0 : _state$common.user;
|
755
|
+
});
|
1316
756
|
var resetAuth = function resetAuth() {
|
1317
|
-
|
1318
|
-
signOut();
|
1319
|
-
onNavigate("/login");
|
757
|
+
handleSignOut();
|
1320
758
|
};
|
759
|
+
var checkRoleUser = React.useCallback(function () {
|
760
|
+
var _user$roles, _user$roles2;
|
761
|
+
if (!user) return;
|
762
|
+
var isAdmin = (_user$roles = user.roles) === null || _user$roles === void 0 ? void 0 : _user$roles.includes("Admin");
|
763
|
+
if (isAdmin && role !== "Teacher") alert(user.email + " not allow to register " + role);
|
764
|
+
if (isAdmin) return;
|
765
|
+
if (!((_user$roles2 = user.roles) !== null && _user$roles2 !== void 0 && _user$roles2.includes(role))) {
|
766
|
+
alert(user.email + " not allow to register " + role);
|
767
|
+
resetAuth();
|
768
|
+
}
|
769
|
+
}, [role, JSON.stringify(user)]);
|
1321
770
|
var loadInfo = function loadInfo() {
|
1322
771
|
try {
|
1323
772
|
var _temp2 = function _temp2() {
|
@@ -1336,7 +785,11 @@ var LayoutContext = function LayoutContext(_ref) {
|
|
1336
785
|
}
|
1337
786
|
dispatch(setUser(info.data));
|
1338
787
|
});
|
1339
|
-
}, function () {
|
788
|
+
}, function (err) {
|
789
|
+
console.log({
|
790
|
+
err: err
|
791
|
+
});
|
792
|
+
role === "Student" ? alert("학생, 다시 로그인해주세요.") : alert("선생님, 다시 로그인해주세요.");
|
1340
793
|
resetAuth();
|
1341
794
|
});
|
1342
795
|
return Promise.resolve(_temp && _temp.then ? _temp.then(_temp2) : _temp2(_temp));
|
@@ -1345,8 +798,9 @@ var LayoutContext = function LayoutContext(_ref) {
|
|
1345
798
|
}
|
1346
799
|
};
|
1347
800
|
React.useEffect(function () {
|
1348
|
-
loadInfo();
|
1349
|
-
|
801
|
+
!user && loadInfo();
|
802
|
+
!!user && checkRoleUser();
|
803
|
+
}, [JSON.stringify(user)]);
|
1350
804
|
return React__default.createElement(React.Fragment, null, children);
|
1351
805
|
};
|
1352
806
|
|
@@ -1562,6 +1016,7 @@ var description_success = "스터디 터치는 엄태욱 선생님의 수업에
|
|
1562
1016
|
var logout = "로그 아웃";
|
1563
1017
|
var overall_status = "전체 현황";
|
1564
1018
|
var exam_status = "시험별 현";
|
1019
|
+
var student_status = "학생 신분";
|
1565
1020
|
var user_manager = "사용자 목록";
|
1566
1021
|
var recent_exam_results = "최근 시험 결과";
|
1567
1022
|
var instructor_name = "강사이름";
|
@@ -1606,6 +1061,7 @@ var no_data = "데이터 없음";
|
|
1606
1061
|
var internet_connection_was_lost = "인터넷 연결이 끊어졌습니다";
|
1607
1062
|
var problem = "문제";
|
1608
1063
|
var problem_solving_time = "문제풀이 시간";
|
1064
|
+
var minutes = "분";
|
1609
1065
|
var lang_ko = {
|
1610
1066
|
problem_solving: problem_solving,
|
1611
1067
|
my_story: my_story,
|
@@ -1617,6 +1073,7 @@ var lang_ko = {
|
|
1617
1073
|
logout: logout,
|
1618
1074
|
overall_status: overall_status,
|
1619
1075
|
exam_status: exam_status,
|
1076
|
+
student_status: student_status,
|
1620
1077
|
user_manager: user_manager,
|
1621
1078
|
recent_exam_results: recent_exam_results,
|
1622
1079
|
instructor_name: instructor_name,
|
@@ -1660,7 +1117,8 @@ var lang_ko = {
|
|
1660
1117
|
no_data: no_data,
|
1661
1118
|
internet_connection_was_lost: internet_connection_was_lost,
|
1662
1119
|
problem: problem,
|
1663
|
-
problem_solving_time: problem_solving_time
|
1120
|
+
problem_solving_time: problem_solving_time,
|
1121
|
+
minutes: minutes
|
1664
1122
|
};
|
1665
1123
|
|
1666
1124
|
var problem_solving$1 = "Problem Solving";
|
@@ -1673,6 +1131,7 @@ var description_success$1 = "Study Touch is a learning tool used in teacher Taew
|
|
1673
1131
|
var logout$1 = "Logout";
|
1674
1132
|
var overall_status$1 = "Overall Status";
|
1675
1133
|
var exam_status$1 = "Exam Status";
|
1134
|
+
var student_status$1 = "Student Status";
|
1676
1135
|
var user_manager$1 = "User Manager";
|
1677
1136
|
var recent_exam_results$1 = "Recent exam";
|
1678
1137
|
var instructor_name$1 = "Instructor name";
|
@@ -1717,6 +1176,7 @@ var no_data$1 = "No data";
|
|
1717
1176
|
var internet_connection_was_lost$1 = "Internet connection was lost";
|
1718
1177
|
var problem$1 = "Problem ";
|
1719
1178
|
var problem_solving_time$1 = "Problem solving time";
|
1179
|
+
var minutes$1 = "m";
|
1720
1180
|
var lang_en = {
|
1721
1181
|
problem_solving: problem_solving$1,
|
1722
1182
|
my_story: my_story$1,
|
@@ -1728,6 +1188,7 @@ var lang_en = {
|
|
1728
1188
|
logout: logout$1,
|
1729
1189
|
overall_status: overall_status$1,
|
1730
1190
|
exam_status: exam_status$1,
|
1191
|
+
student_status: student_status$1,
|
1731
1192
|
user_manager: user_manager$1,
|
1732
1193
|
recent_exam_results: recent_exam_results$1,
|
1733
1194
|
instructor_name: instructor_name$1,
|
@@ -1771,7 +1232,8 @@ var lang_en = {
|
|
1771
1232
|
no_data: no_data$1,
|
1772
1233
|
internet_connection_was_lost: internet_connection_was_lost$1,
|
1773
1234
|
problem: problem$1,
|
1774
|
-
problem_solving_time: problem_solving_time$1
|
1235
|
+
problem_solving_time: problem_solving_time$1,
|
1236
|
+
minutes: minutes$1
|
1775
1237
|
};
|
1776
1238
|
|
1777
1239
|
i18n.use(reactI18next.initReactI18next).init({
|
@@ -1903,7 +1365,20 @@ var toISOString = (function (time) {
|
|
1903
1365
|
}
|
1904
1366
|
});
|
1905
1367
|
|
1906
|
-
var
|
1368
|
+
var canAccess = function canAccess(userRoles, componentRoles) {
|
1369
|
+
if (!Array.isArray(userRoles)) {
|
1370
|
+
return false;
|
1371
|
+
}
|
1372
|
+
if (Array.isArray(componentRoles)) {
|
1373
|
+
var intersects = userRoles.filter(function (i) {
|
1374
|
+
return componentRoles.includes(i);
|
1375
|
+
});
|
1376
|
+
return intersects.length > 0;
|
1377
|
+
}
|
1378
|
+
return true;
|
1379
|
+
};
|
1380
|
+
|
1381
|
+
var historyCore = history.createBrowserHistory();
|
1907
1382
|
|
1908
1383
|
Object.defineProperty(exports, 'I18nextProvider', {
|
1909
1384
|
enumerable: true,
|
@@ -1932,6 +1407,7 @@ exports.NotFound = NotFound;
|
|
1932
1407
|
exports.PUSHER_CONFIG = PUSHER_CONFIG;
|
1933
1408
|
exports.TheLanguageDropdown = TheLanguageDropdown;
|
1934
1409
|
exports.api = api$1;
|
1410
|
+
exports.canAccessRoute = canAccess;
|
1935
1411
|
exports.diffFromNow = diffFromNow;
|
1936
1412
|
exports.formatTime = formatTime;
|
1937
1413
|
exports.historyCore = historyCore;
|