@opencloning/opencloningdb 1.7.1 → 1.8.0

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/CHANGELOG.md CHANGED
@@ -1,5 +1,25 @@
1
1
  # @opencloning/opencloningdb
2
2
 
3
+ ## 1.8.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#711](https://github.com/OpenCloning/OpenCloning_frontend/pull/711) [`6813620`](https://github.com/OpenCloning/OpenCloning_frontend/commit/6813620f4a47c44857045866d667474efbf9a64c) Thanks [@manulera](https://github.com/manulera)! - Use authentication for cloning endpoints in opencloning-db
8
+
9
+ ### Patch Changes
10
+
11
+ - Updated dependencies [[`6813620`](https://github.com/OpenCloning/OpenCloning_frontend/commit/6813620f4a47c44857045866d667474efbf9a64c)]:
12
+ - @opencloning/utils@1.9.0
13
+ - @opencloning/ui@1.9.0
14
+
15
+ ## 1.7.2
16
+
17
+ ### Patch Changes
18
+
19
+ - Updated dependencies [[`08144c0`](https://github.com/OpenCloning/OpenCloning_frontend/commit/08144c085cb5da37e902edc1a3b9c593c58ab680)]:
20
+ - @opencloning/ui@1.8.2
21
+ - @opencloning/utils@1.8.2
22
+
3
23
  ## 1.7.1
4
24
 
5
25
  ### Patch Changes
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "license": "MIT",
3
3
  "name": "@opencloning/opencloningdb",
4
- "version": "1.7.1",
4
+ "version": "1.8.0",
5
5
  "type": "module",
6
6
  "main": "./src/index.js",
7
7
  "exports": {
@@ -15,8 +15,8 @@
15
15
  "dependencies": {
16
16
  "@mui/icons-material": "^5.18.0",
17
17
  "@mui/material": "^5.18.0",
18
- "@opencloning/ui": "1.8.1",
19
- "@opencloning/utils": "1.8.1",
18
+ "@opencloning/ui": "1.9.0",
19
+ "@opencloning/utils": "1.9.0",
20
20
  "axios": "^1.16.0"
21
21
  },
22
22
  "peerDependencies": {
package/src/common.js CHANGED
@@ -1,12 +1,9 @@
1
1
  import axios from 'axios';
2
+ import { attachAuthInterceptors, setHttpClientUnauthorizedHandler } from '@opencloning/utils/httpClientAuth';
2
3
 
3
- export const baseUrl = 'http://localhost:8001';
4
+ export const baseUrl = 'http://localhost:8000/db';
4
5
 
5
- let unauthorizedHandler = null;
6
-
7
- export function setUnauthorizedHandler(fn) {
8
- unauthorizedHandler = fn;
9
- }
6
+ export const setUnauthorizedHandler = setHttpClientUnauthorizedHandler;
10
7
 
11
8
  export function setWorkspaceHeader(id) {
12
9
  openCloningDBHttpClient.defaults.headers.common['X-Workspace-Id'] = id;
@@ -41,20 +38,4 @@ export const openCloningDBHttpClient = axios.create({
41
38
  },
42
39
  });
43
40
 
44
- openCloningDBHttpClient.interceptors.request.use((config) => {
45
- const token = localStorage.getItem('token');
46
- if (token) {
47
- config.headers.Authorization = `Bearer ${token}`;
48
- }
49
- return config;
50
- });
51
-
52
- openCloningDBHttpClient.interceptors.response.use(
53
- (response) => response,
54
- (error) => {
55
- if (error.response?.status === 401 && unauthorizedHandler) {
56
- unauthorizedHandler();
57
- }
58
- return Promise.reject(error);
59
- },
60
- );
41
+ attachAuthInterceptors(openCloningDBHttpClient);
@@ -26,7 +26,7 @@ afterEach(() => {
26
26
 
27
27
  describe('common', () => {
28
28
  it('exports the expected base URL', () => {
29
- expect(baseUrl).toBe('http://localhost:8001');
29
+ expect(baseUrl).toBe('http://localhost:8000/db');
30
30
  });
31
31
 
32
32
  it('sets and clears the workspace header', () => {