| ... |
... |
@@ -14,12 +14,18 @@ |
| 14 |
14 |
const driveId = getDriveId(driveURL.value); |
| 15 |
15 |
if(driveId) { |
| 16 |
16 |
console.log('Perform request with id:', driveId); |
|
17 |
+ fetch(`/rest/v1/collabs?driveId=${driveId}`) |
|
18 |
+ .then(res => res.json()) |
|
19 |
+ .then(json => { |
|
20 |
+ const { link } = json; |
|
21 |
+ window.location.pathname = link; |
|
22 |
+ }) |
| 17 |
17 |
} |
| 18 |
18 |
} |
| 19 |
19 |
function getDriveId(driveURL) { |
| 20 |
20 |
const url = new URL(driveURL); |
| 21 |
21 |
const re = /\/(library|lib)\/([^/]*)\/.*/; |
| 22 |
|
- const id = re.exec(url.pathname)[1]; |
|
28 |
+ const id = re.exec(url.pathname)[2]; |
| 23 |
23 |
return id; |
| 24 |
24 |
} |
| 25 |
25 |
})(); |