docs: update OAS of reset password routes (#11711)
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import { useBaseSpecs } from "@/providers/base-specs"
|
||||
import type { OpenAPIV3 } from "openapi-types"
|
||||
import { Card } from "docs-ui"
|
||||
import { useMemo } from "react"
|
||||
|
||||
export type TagsOperationDescriptionSectionSecurityProps = {
|
||||
security: OpenAPIV3.SecurityRequirementObject[]
|
||||
@@ -11,6 +12,15 @@ const TagsOperationDescriptionSectionSecurity = ({
|
||||
}: TagsOperationDescriptionSectionSecurityProps) => {
|
||||
const { getSecuritySchema } = useBaseSpecs()
|
||||
|
||||
const linkToAuth = useMemo(() => {
|
||||
const hasNoAuth = security.some((item) => {
|
||||
const schema = getSecuritySchema(Object.keys(item)[0])
|
||||
return schema && schema["x-is-auth"] === false
|
||||
})
|
||||
|
||||
return !hasNoAuth
|
||||
}, [security, getSecuritySchema])
|
||||
|
||||
const getDescription = () => {
|
||||
let str = ""
|
||||
security.forEach((item) => {
|
||||
@@ -27,7 +37,7 @@ const TagsOperationDescriptionSectionSecurity = ({
|
||||
<Card
|
||||
title="Authorization"
|
||||
text={getDescription()}
|
||||
href="#authentication"
|
||||
href={linkToAuth ? "#authentication" : undefined}
|
||||
/>
|
||||
</div>
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user