kitchen-simulator 1.1.1-test.79 → 1.1.1-test.80
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/es/actions/export.js
CHANGED
|
@@ -8,7 +8,7 @@ import * as verticesActions from "./vertices-actions";
|
|
|
8
8
|
import * as itemsActions from "./items-actions";
|
|
9
9
|
import * as areaActions from "./area-actions";
|
|
10
10
|
import * as groupsActions from "./groups-actions";
|
|
11
|
-
|
|
11
|
+
|
|
12
12
|
export { projectActions, viewer2DActions, viewer3DActions, linesActions, holesActions, sceneActions, verticesActions, itemsActions, areaActions, groupsActions, userActions };
|
|
13
13
|
export default {
|
|
14
14
|
projectActions: projectActions,
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { LOGIN_SUCCESS, LOGIN_ERROR, LOGOUT, SET_USER_DATA, LOCAL_STORAGE_TOKEN_VALUE, LOCAL_STORAGE_ORIGINAL_TOKEN, LOCAL_STORAGE_TOKEN_NAME } from "../constants";
|
|
2
|
+
import jwtService from "../components/login/jwtService";
|
|
3
|
+
import history from "../@history";
|
|
4
|
+
import ls from 'localstorage-slim';
|
|
5
|
+
export function submitLogin(values) {
|
|
6
|
+
jwtService.signInWithEmailAndPassword(values).then(function (response) {
|
|
7
|
+
console.log(response);
|
|
8
|
+
if (response.data.user) {
|
|
9
|
+
setUser(response.data.user);
|
|
10
|
+
setSession(response.data.token);
|
|
11
|
+
return {
|
|
12
|
+
type: LOGIN_SUCCESS,
|
|
13
|
+
user: response.data.user
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
})["catch"](function (error) {
|
|
17
|
+
return {
|
|
18
|
+
type: LOGIN_ERROR,
|
|
19
|
+
payload: error
|
|
20
|
+
};
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
export function logout() {
|
|
24
|
+
jwtService.logout();
|
|
25
|
+
history.push({
|
|
26
|
+
pathname: '/login'
|
|
27
|
+
});
|
|
28
|
+
return {
|
|
29
|
+
type: LOGOUT
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
export function login(userid, role, token, utmObj) {
|
|
33
|
+
var projectId = sessionStorage.getItem('projectId');
|
|
34
|
+
if (projectId === null) projectId = 'new';
|
|
35
|
+
var utm = new URLSearchParams(Object.entries(utmObj));
|
|
36
|
+
var visualizerName = sessionStorage.getItem('visualizerName');
|
|
37
|
+
var originalAccessToken = ls.get(LOCAL_STORAGE_ORIGINAL_TOKEN);
|
|
38
|
+
var tokenName = ls.get(LOCAL_STORAGE_TOKEN_NAME);
|
|
39
|
+
var extraParams = '';
|
|
40
|
+
if (tokenName && originalAccessToken) {
|
|
41
|
+
extraParams = "&".concat(tokenName).concat(originalAccessToken);
|
|
42
|
+
}
|
|
43
|
+
history.push({
|
|
44
|
+
pathname: "/".concat(visualizerName, "/project/").concat(role, "/").concat(token, "/").concat(projectId, "?").concat(utm.toString()).concat(extraParams)
|
|
45
|
+
});
|
|
46
|
+
return {
|
|
47
|
+
type: LOGIN_SUCCESS,
|
|
48
|
+
userid: userid
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
export function setUserData(user) {
|
|
52
|
+
return function (dispatch) {
|
|
53
|
+
dispatch({
|
|
54
|
+
type: SET_USER_DATA,
|
|
55
|
+
payload: user
|
|
56
|
+
});
|
|
57
|
+
};
|
|
58
|
+
}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.login = login;
|
|
8
|
+
exports.logout = logout;
|
|
9
|
+
exports.setUserData = setUserData;
|
|
10
|
+
exports.submitLogin = submitLogin;
|
|
11
|
+
var _constants = require("../constants");
|
|
12
|
+
var _jwtService = _interopRequireDefault(require("../components/login/jwtService"));
|
|
13
|
+
var _history = _interopRequireDefault(require("../@history"));
|
|
14
|
+
var _localstorageSlim = _interopRequireDefault(require("localstorage-slim"));
|
|
15
|
+
function submitLogin(values) {
|
|
16
|
+
_jwtService["default"].signInWithEmailAndPassword(values).then(function (response) {
|
|
17
|
+
console.log(response);
|
|
18
|
+
if (response.data.user) {
|
|
19
|
+
setUser(response.data.user);
|
|
20
|
+
setSession(response.data.token);
|
|
21
|
+
return {
|
|
22
|
+
type: _constants.LOGIN_SUCCESS,
|
|
23
|
+
user: response.data.user
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
})["catch"](function (error) {
|
|
27
|
+
return {
|
|
28
|
+
type: _constants.LOGIN_ERROR,
|
|
29
|
+
payload: error
|
|
30
|
+
};
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
function logout() {
|
|
34
|
+
_jwtService["default"].logout();
|
|
35
|
+
_history["default"].push({
|
|
36
|
+
pathname: '/login'
|
|
37
|
+
});
|
|
38
|
+
return {
|
|
39
|
+
type: _constants.LOGOUT
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
function login(userid, role, token, utmObj) {
|
|
43
|
+
var projectId = sessionStorage.getItem('projectId');
|
|
44
|
+
if (projectId === null) projectId = 'new';
|
|
45
|
+
var utm = new URLSearchParams(Object.entries(utmObj));
|
|
46
|
+
var visualizerName = sessionStorage.getItem('visualizerName');
|
|
47
|
+
var originalAccessToken = _localstorageSlim["default"].get(_constants.LOCAL_STORAGE_ORIGINAL_TOKEN);
|
|
48
|
+
var tokenName = _localstorageSlim["default"].get(_constants.LOCAL_STORAGE_TOKEN_NAME);
|
|
49
|
+
var extraParams = '';
|
|
50
|
+
if (tokenName && originalAccessToken) {
|
|
51
|
+
extraParams = "&".concat(tokenName).concat(originalAccessToken);
|
|
52
|
+
}
|
|
53
|
+
_history["default"].push({
|
|
54
|
+
pathname: "/".concat(visualizerName, "/project/").concat(role, "/").concat(token, "/").concat(projectId, "?").concat(utm.toString()).concat(extraParams)
|
|
55
|
+
});
|
|
56
|
+
return {
|
|
57
|
+
type: _constants.LOGIN_SUCCESS,
|
|
58
|
+
userid: userid
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
function setUserData(user) {
|
|
62
|
+
return function (dispatch) {
|
|
63
|
+
dispatch({
|
|
64
|
+
type: _constants.SET_USER_DATA,
|
|
65
|
+
payload: user
|
|
66
|
+
});
|
|
67
|
+
};
|
|
68
|
+
}
|