@vocollege/app 0.0.99 → 0.0.100

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.
@@ -53,12 +53,11 @@ Object.defineProperty(exports, "__esModule", { value: true });
53
53
  var client_1 = require("@apollo/client");
54
54
  var error_1 = require("@apollo/client/link/error");
55
55
  var apollo_upload_client_1 = require("apollo-upload-client");
56
- // import { getMainDefinition } from "@apollo/client/utilities";
57
- // import { WebSocketLink } from "@apollo/client/link/ws";
58
56
  var VoAuth_1 = __importDefault(require("../VoAuth"));
59
57
  var VoRouter_1 = __importDefault(require("../VoRouter"));
60
- // import ws from "ws";
61
58
  var VoGroups_1 = __importDefault(require("../VoGroups"));
59
+ var VoConfig_1 = __importDefault(require("../VoConfig"));
60
+ var VoHelpers_1 = require("../VoHelpers");
62
61
  function redirect() {
63
62
  return __awaiter(this, void 0, void 0, function () {
64
63
  return __generator(this, function (_a) {
@@ -178,13 +177,14 @@ var GraphClient = /** @class */ (function () {
178
177
  var currentGroup = VoGroups_1.default.getCurrent(true);
179
178
  groupId = currentGroup ? currentGroup.id : "";
180
179
  }
181
- operation.setContext(function () { return (__assign(__assign({}, currentHeaders), { headers: {
182
- Authorization: token
180
+ var masquerade = VoHelpers_1.localStorage.get(VoConfig_1.default.get.MASQUERADE_USER);
181
+ if (masquerade) {
182
+ masquerade = JSON.parse(masquerade);
183
+ }
184
+ operation.setContext(function () { return (__assign(__assign({}, currentHeaders), { headers: __assign({ Authorization: token
183
185
  ? // ? `${token.token_type} ${token.access_token}`
184
186
  "Bearer ".concat(token.access_token)
185
- : "",
186
- VoGroup: groupId,
187
- } })); });
187
+ : "", VoGroup: groupId }, (masquerade && { VoMasquerade: masquerade === null || masquerade === void 0 ? void 0 : masquerade.id })) })); });
188
188
  return forward(operation);
189
189
  });
190
190
  var omitTypenameLink = new client_1.ApolloLink(function (operation, forward) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vocollege/app",
3
- "version": "0.0.99",
3
+ "version": "0.0.100",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {
@@ -9,13 +9,11 @@ import {
9
9
  } from "@apollo/client";
10
10
  import { onError } from "@apollo/client/link/error";
11
11
  import { createUploadLink } from "apollo-upload-client";
12
- // import { getMainDefinition } from "@apollo/client/utilities";
13
- // import { WebSocketLink } from "@apollo/client/link/ws";
14
12
  import VoAuth from "../VoAuth";
15
13
  import VoRouter from "../VoRouter";
16
- // import ws from "ws";
17
14
  import VoGroups from "../VoGroups";
18
- // import VoApp from "../VoApp";
15
+ import VoConfig from "../VoConfig";
16
+ import { localStorage } from "../VoHelpers";
19
17
  import { GeneralObject } from "../../global";
20
18
 
21
19
  async function redirect() {
@@ -138,6 +136,13 @@ class GraphClient {
138
136
  const currentGroup = VoGroups.getCurrent(true);
139
137
  groupId = currentGroup ? currentGroup.id : "";
140
138
  }
139
+
140
+ let masquerade: any = localStorage.get(VoConfig.get.MASQUERADE_USER);
141
+
142
+ if (masquerade) {
143
+ masquerade = JSON.parse(masquerade);
144
+ }
145
+
141
146
  operation.setContext(() => ({
142
147
  ...currentHeaders,
143
148
  headers: {
@@ -146,6 +151,7 @@ class GraphClient {
146
151
  `Bearer ${token.access_token}`
147
152
  : "",
148
153
  VoGroup: groupId,
154
+ ...(masquerade && { VoMasquerade: masquerade?.id }),
149
155
  },
150
156
  }));
151
157
  return forward(operation);