@vocollege/app 0.0.79 → 0.0.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.
@@ -3,7 +3,7 @@ declare class VoDocs extends VoBase {
3
3
  graphqlClient: any;
4
4
  init(): void;
5
5
  get getGraphqlUrl(): string;
6
- getTemporaryFileUrl(id: string): Promise<import("axios").AxiosResponse<any>>;
6
+ getTemporaryFileUrl(id: string, publicDownload?: boolean): Promise<import("axios").AxiosResponse<any>>;
7
7
  }
8
8
  declare const _default: VoDocs;
9
9
  export default _default;
@@ -77,16 +77,21 @@ var VoDocs = /** @class */ (function (_super) {
77
77
  enumerable: false,
78
78
  configurable: true
79
79
  });
80
- VoDocs.prototype.getTemporaryFileUrl = function (id) {
80
+ VoDocs.prototype.getTemporaryFileUrl = function (id, publicDownload) {
81
+ if (publicDownload === void 0) { publicDownload = false; }
81
82
  return __awaiter(this, void 0, void 0, function () {
82
- var currentGroup, url;
83
+ var currentGroup, endpoint, url;
83
84
  return __generator(this, function (_a) {
84
85
  try {
85
86
  currentGroup = VoGroups_1.default.getCurrent(true);
86
87
  axios_1.default.defaults.headers.common["VoGroup"] = currentGroup
87
88
  ? currentGroup.id
88
89
  : "";
89
- url = "".concat(this.getUrl, "/docs/download/").concat(id);
90
+ endpoint = "download";
91
+ if (publicDownload) {
92
+ endpoint = "download-public";
93
+ }
94
+ url = "".concat(this.getUrl, "/docs/").concat(endpoint, "/").concat(id);
90
95
  return [2 /*return*/, axios_1.default.get(url)];
91
96
  }
92
97
  catch (error) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vocollege/app",
3
- "version": "0.0.79",
3
+ "version": "0.0.80",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {
@@ -22,13 +22,17 @@ class VoDocs extends VoBase {
22
22
  return VoConfig.get.DOCS_BASE_URL + "" + VoConfig.get.DOCS_GRAPHQL;
23
23
  }
24
24
 
25
- async getTemporaryFileUrl(id: string) {
25
+ async getTemporaryFileUrl(id: string, publicDownload = false) {
26
26
  try {
27
27
  let currentGroup = VoGroups.getCurrent(true);
28
28
  axios.defaults.headers.common["VoGroup"] = currentGroup
29
29
  ? currentGroup.id
30
30
  : "";
31
- const url = `${this.getUrl}/docs/download/${id}`;
31
+ let endpoint = "download";
32
+ if (publicDownload) {
33
+ endpoint = "download-public";
34
+ }
35
+ const url = `${this.getUrl}/docs/${endpoint}/${id}`;
32
36
  return axios.get(url);
33
37
  } catch (error) {
34
38
  throw error;