Skip to content

Commit b70646b

Browse files
committed
api doc update
1 parent 368aec2 commit b70646b

File tree

1 file changed

+23
-14
lines changed

1 file changed

+23
-14
lines changed

src/pages/api-doc/index.jsx

Lines changed: 23 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2,29 +2,38 @@ import React, { useState, useEffect } from 'react';
22
import Layout from '@theme/Layout';
33
import Tabs from '@theme/Tabs';
44
import TabItem from '@theme/TabItem';
5+
import { useLocation } from 'react-router-dom';
56

67

78

89

910

1011

1112
function ApiDoc() {
13+
const location = useLocation();
1214
useEffect(() => {
13-
const removeAlternateLinks = () => {
14-
const alternateLinks = document.querySelectorAll('link[rel="alternate"]');
15-
alternateLinks.forEach(link => link.parentNode.removeChild(link));
16-
};
17-
removeAlternateLinks();
18-
const observer = new MutationObserver((mutationsList) => {
19-
for (const mutation of mutationsList) {
20-
if (mutation.type === 'childList') {
21-
removeAlternateLinks();
15+
console.log(location.pathname)
16+
if (location.pathname === '/support/api-doc/') {
17+
const removeAlternateLinks = () => {
18+
const alternateLinks = document.querySelectorAll('link[rel="alternate"]');
19+
alternateLinks.forEach(link => link.parentNode.removeChild(link));
20+
};
21+
22+
removeAlternateLinks();
23+
24+
const observer = new MutationObserver((mutationsList) => {
25+
for (const mutation of mutationsList) {
26+
if (mutation.type === 'childList') {
27+
removeAlternateLinks();
28+
}
2229
}
23-
}
24-
});
25-
observer.observe(document.body, { childList: true, subtree: true });
26-
return () => observer.disconnect();
27-
}, []);
30+
});
31+
32+
observer.observe(document.body, { childList: true, subtree: true });
33+
34+
return () => observer.disconnect();
35+
}
36+
}, [location.pathname]);
2837
return (
2938
<Layout title="LambdaTest API Documentation"
3039
description="Manage and organize your test builds, test sessions, tunnel status and more with LambdaTest APIs for Selenium automation, App automation, Smart UI automation and Automated screenshots. ">

0 commit comments

Comments
 (0)