@vocollege/app 0.0.73 → 0.0.74
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.
|
@@ -61,6 +61,7 @@ var GraphClient_1 = __importDefault(require("./GraphClient"));
|
|
|
61
61
|
var VoBase_1 = __importDefault(require("../VoBase"));
|
|
62
62
|
// import VoAuth from "../VoAuth";
|
|
63
63
|
var VoConfig_1 = __importDefault(require("../VoConfig"));
|
|
64
|
+
var VoHelpers_1 = require("../VoHelpers");
|
|
64
65
|
var VoApi = /** @class */ (function (_super) {
|
|
65
66
|
__extends(VoApi, _super);
|
|
66
67
|
function VoApi() {
|
|
@@ -93,12 +94,18 @@ var VoApi = /** @class */ (function (_super) {
|
|
|
93
94
|
});
|
|
94
95
|
VoApi.prototype.getUser = function () {
|
|
95
96
|
return __awaiter(this, void 0, void 0, function () {
|
|
96
|
-
var user, error_1;
|
|
97
|
+
var url, masquerade, user, error_1;
|
|
97
98
|
return __generator(this, function (_a) {
|
|
98
99
|
switch (_a.label) {
|
|
99
100
|
case 0:
|
|
100
101
|
_a.trys.push([0, 2, , 3]);
|
|
101
|
-
|
|
102
|
+
url = this.getUrl + "/user";
|
|
103
|
+
masquerade = VoHelpers_1.localStorage.get(VoConfig_1.default.get.MASQUERADE_USER);
|
|
104
|
+
if (masquerade) {
|
|
105
|
+
masquerade = JSON.parse(masquerade);
|
|
106
|
+
url = "".concat(url, "?masquerade=").concat(masquerade === null || masquerade === void 0 ? void 0 : masquerade.id);
|
|
107
|
+
}
|
|
108
|
+
return [4 /*yield*/, axios_1.default.get(url)];
|
|
102
109
|
case 1:
|
|
103
110
|
user = _a.sent();
|
|
104
111
|
return [2 /*return*/, user];
|
package/dist/modules/VoConfig.js
CHANGED
package/package.json
CHANGED
|
@@ -16,6 +16,7 @@ import VoBase from "../VoBase";
|
|
|
16
16
|
// import VoAuth from "../VoAuth";
|
|
17
17
|
import VoConfig from "../VoConfig";
|
|
18
18
|
import { GeneralObject } from "../../global";
|
|
19
|
+
import { localStorage } from "../VoHelpers";
|
|
19
20
|
|
|
20
21
|
class VoApi extends VoBase {
|
|
21
22
|
graphqlClient: any;
|
|
@@ -49,7 +50,13 @@ class VoApi extends VoBase {
|
|
|
49
50
|
|
|
50
51
|
async getUser() {
|
|
51
52
|
try {
|
|
52
|
-
|
|
53
|
+
let url = this.getUrl + "/user";
|
|
54
|
+
let masquerade: any = localStorage.get(VoConfig.get.MASQUERADE_USER);
|
|
55
|
+
if (masquerade) {
|
|
56
|
+
masquerade = JSON.parse(masquerade);
|
|
57
|
+
url = `${url}?masquerade=${masquerade?.id}`;
|
|
58
|
+
}
|
|
59
|
+
const user = await axios.get(url);
|
|
53
60
|
return user;
|
|
54
61
|
} catch (error) {
|
|
55
62
|
throw error;
|