message: fix: logic to edit api pages
diff: const preFix =
  - "https://github.com/react-hook-form/documentation/edit/master/src/data/"
  + "https://github.com/react-hook-form/documentation/edit/master/src/"
  +
  +const dataPreFix = "data/"
  +const pagesPreFix = "pages/"
  +
  +const filterApiPageURL = (pathname) => {
  + if (pathname.charAt(pathname.length - 1) === "/")
  + return pathname.substring(0, pathname.length - 1).substring(1)
  +
  + return pathname.substring(1)
  +}
  export const getEditLink = (
  currentLanguage: string,
  @@ -8,22 +18,26 @@ export const getEditLink = (
  if (!pathname) return ""
  if (pathname === "/" || pathname === "") {
  - return preFix + "home.tsx"
  + return `${preFix}${dataPreFix}/home.tsx`
  } else if (pathname.includes("get-started")) {
  - return `${preFix}${currentLanguage}/getStarted.tsx`
  + return `${preFix}${dataPreFix}${currentLanguage}/getStarted.tsx`
  } else if (pathname.includes("api")) {
  - return `${preFix}${currentLanguage}/api.tsx`
  + const splitPath = pathname.split("/")
  + if (splitPath.length === 2 || splitPath[2] === "") {
  + return `${preFix}${dataPreFix}${currentLanguage}/api.tsx`
  + }
  + return `${preFix}${pagesPreFix}${filterApiPageURL(pathname)}.tsx`
  } else if (pathname.includes("ts")) {
  - return `${preFix}ts.tsx`
  + return `${preFix}${dataPreFix}ts.tsx`
  } else if (pathname.includes("advanced-usage")) {
  - return `${preFix}${currentLanguage}/advanced.tsx`
  + return `${preFix}${dataPreFix}${currentLanguage}/advanced.tsx`
  } else if (pathname.includes("faqs")) {
  - return `${preFix}${currentLanguage}/faq.tsx`
  + return `${preFix}${dataPreFix}${currentLanguage}/faq.tsx`
  } else if (pathname.includes("dev-tools")) {
  - return `${preFix}${currentLanguage}/devtools.tsx`
  + return `${preFix}${dataPreFix}${currentLanguage}/devtools.tsx`
  } else if (pathname.includes("form-builder")) {
  - return `${preFix}builder.tsx`
  + return `${preFix}${dataPreFix}builder.tsx`
  } else if (pathname.includes("resources")) {
  - return `${preFix}resources.tsx`
  + return `${preFix}${dataPreFix}resources.tsx`
  }
  }
  