mirror of
https://github.com/oceanprotocol/docs.git
synced 2024-11-26 19:49:26 +01:00
Show correct Aquarius rest enpoints (#699)
This commit is contained in:
parent
5481cc81c2
commit
96ba9671cd
@ -1,7 +1,6 @@
|
|||||||
import React from 'react'
|
import React from 'react'
|
||||||
import PropTypes from 'prop-types'
|
import PropTypes from 'prop-types'
|
||||||
import slugify from 'slugify'
|
import slugify from 'slugify'
|
||||||
import { cleanPathKey } from './utils'
|
|
||||||
import styles from './Paths.module.scss'
|
import styles from './Paths.module.scss'
|
||||||
import stylesDoc from '../Doc.module.scss'
|
import stylesDoc from '../Doc.module.scss'
|
||||||
|
|
||||||
@ -142,9 +141,9 @@ Method.propTypes = {
|
|||||||
|
|
||||||
const Paths = ({ paths }) =>
|
const Paths = ({ paths }) =>
|
||||||
Object.entries(paths).map(([key, value]) => (
|
Object.entries(paths).map(([key, value]) => (
|
||||||
<div key={key} id={slugify(cleanPathKey(key))}>
|
<div key={key} id={slugify(key)}>
|
||||||
<h2 className={stylesDoc.pathName}>
|
<h2 className={stylesDoc.pathName}>
|
||||||
<code>{cleanPathKey(key)}</code>
|
<code>{key}</code>
|
||||||
</h2>
|
</h2>
|
||||||
|
|
||||||
{Object.entries(value).map(([key, value]) => (
|
{Object.entries(value).map(([key, value]) => (
|
||||||
|
@ -9,29 +9,47 @@ import stylesSidebar from '../../components/Sidebar.module.scss'
|
|||||||
const Toc = ({ data }) => {
|
const Toc = ({ data }) => {
|
||||||
const Ids = []
|
const Ids = []
|
||||||
|
|
||||||
const items = Object.keys(data.paths).map((key) => {
|
const itemsV1 = Object.keys(data.paths)
|
||||||
Ids.push(slugify(cleanPathKey(key)))
|
.filter((key) => key.startsWith('/api/v1/aquarius'))
|
||||||
|
.map((key) => {
|
||||||
|
Ids.push(slugify(key))
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<li key={key}>
|
<li key={key}>
|
||||||
<Scroll
|
<Scroll type="id" element={`${slugify(key)}`} offset={-20}>
|
||||||
type="id"
|
<code>{cleanPathKey(key)}</code>
|
||||||
element={`${slugify(cleanPathKey(key))}`}
|
</Scroll>
|
||||||
offset={-20}
|
</li>
|
||||||
>
|
)
|
||||||
<code>{cleanPathKey(key)}</code>
|
})
|
||||||
</Scroll>
|
|
||||||
</li>
|
|
||||||
)
|
|
||||||
})
|
|
||||||
|
|
||||||
|
const itemsOther = Object.keys(data.paths)
|
||||||
|
.filter((key) => !key.startsWith('/api/v1/aquarius'))
|
||||||
|
.map((key) => {
|
||||||
|
Ids.push(slugify(key))
|
||||||
|
|
||||||
|
return (
|
||||||
|
<li key={key}>
|
||||||
|
<Scroll type="id" element={`${slugify(key)}`} offset={-20}>
|
||||||
|
<code>{key}</code>
|
||||||
|
</Scroll>
|
||||||
|
</li>
|
||||||
|
)
|
||||||
|
})
|
||||||
return (
|
return (
|
||||||
<Scrollspy
|
<Scrollspy
|
||||||
items={Ids}
|
items={Ids}
|
||||||
currentClassName={stylesSidebar.scrollspyActive}
|
currentClassName={stylesSidebar.scrollspyActive}
|
||||||
offset={-100}
|
offset={-100}
|
||||||
>
|
>
|
||||||
{items}
|
<code>/api/v1/aquarius</code>
|
||||||
|
<ul>{itemsV1}</ul>
|
||||||
|
{itemsOther.length ? (
|
||||||
|
<>
|
||||||
|
<code>Other REST endpoints</code>
|
||||||
|
<ul>{itemsOther}</ul>
|
||||||
|
</>
|
||||||
|
) : null}
|
||||||
</Scrollspy>
|
</Scrollspy>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
@ -4,10 +4,5 @@ export const cleanPathKey = (key) => {
|
|||||||
if (key.includes('aquarius')) {
|
if (key.includes('aquarius')) {
|
||||||
keyCleaned = key.replace(/\/api\/v1\/aquarius/gi, '')
|
keyCleaned = key.replace(/\/api\/v1\/aquarius/gi, '')
|
||||||
}
|
}
|
||||||
|
|
||||||
if (key.includes('brizo')) {
|
|
||||||
keyCleaned = key.replace(/\/api\/v1\/brizo/gi, '')
|
|
||||||
}
|
|
||||||
|
|
||||||
return keyCleaned
|
return keyCleaned
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user