@dative-gpi/foundation-shared-services 1.0.79 → 1.0.81
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/composables/useFiles.ts +5 -1
- package/config/urls/files.ts +7 -1
- package/package.json +3 -3
package/composables/useFiles.ts
CHANGED
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
import { FILE_URL } from "../config/urls";
|
|
2
2
|
|
|
3
|
+
import { useAppAuthToken } from "@dative-gpi/foundation-shared-services/composables";
|
|
4
|
+
|
|
3
5
|
export const useFiles = () => {
|
|
6
|
+
const { authToken } = useAppAuthToken();
|
|
7
|
+
|
|
4
8
|
const downloadFile = (id: string): void => {
|
|
5
|
-
window.open(FILE_URL(id), "_blank");
|
|
9
|
+
window.open(FILE_URL(id, authToken.value), "_blank");
|
|
6
10
|
};
|
|
7
11
|
|
|
8
12
|
const readFile = (file: File): Promise<string | ArrayBuffer | null> => {
|
package/config/urls/files.ts
CHANGED
|
@@ -1,4 +1,10 @@
|
|
|
1
1
|
import { GATEWAY_URL } from "./base";
|
|
2
2
|
|
|
3
3
|
export const FILES_URL = () => `${GATEWAY_URL()}/files`;
|
|
4
|
-
export const FILE_URL = (fileId: string) =>
|
|
4
|
+
export const FILE_URL = (fileId: string, accessToken?: string) => {
|
|
5
|
+
let url = `${FILES_URL()}/${encodeURIComponent(fileId)}`;
|
|
6
|
+
if (accessToken) {
|
|
7
|
+
url += `?access_token=${encodeURIComponent(accessToken)}`;
|
|
8
|
+
}
|
|
9
|
+
return url;
|
|
10
|
+
};
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dative-gpi/foundation-shared-services",
|
|
3
3
|
"sideEffects": false,
|
|
4
|
-
"version": "1.0.
|
|
4
|
+
"version": "1.0.81",
|
|
5
5
|
"description": "",
|
|
6
6
|
"publishConfig": {
|
|
7
7
|
"access": "public"
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
"author": "",
|
|
11
11
|
"license": "ISC",
|
|
12
12
|
"dependencies": {
|
|
13
|
-
"@dative-gpi/foundation-shared-domain": "1.0.
|
|
13
|
+
"@dative-gpi/foundation-shared-domain": "1.0.81"
|
|
14
14
|
},
|
|
15
15
|
"peerDependencies": {
|
|
16
16
|
"@dative-gpi/bones-ui": "^1.0.0",
|
|
@@ -18,5 +18,5 @@
|
|
|
18
18
|
"vue": "^3.4.29",
|
|
19
19
|
"vue-router": "^4.3.0"
|
|
20
20
|
},
|
|
21
|
-
"gitHead": "
|
|
21
|
+
"gitHead": "6cac3b3d9a0036419fad35a4745381ee28d0429c"
|
|
22
22
|
}
|