diff --git a/app/pages/projects/[projectId].tsx b/app/pages/projects/[projectId].tsx
index 588747a..9b1dae0 100644
--- a/app/pages/projects/[projectId].tsx
+++ b/app/pages/projects/[projectId].tsx
@@ -166,10 +166,17 @@ export const Project = () => {
const { stubs } = await invoke(getStubs, { where: { projectId: projectId } })
const stubsForExport = stubs.map(
({ path, method, contentType, statusCode, response, sleep }) => {
- return { path, method, contentType, statusCode, response, sleep }
+ return {
+ path: `/api${project.basePath}${path}`,
+ method,
+ contentType,
+ statusCode,
+ response,
+ sleep: sleep * 1000,
+ }
}
)
- const blob = new Blob([JSON.stringify(stubsForExport)], {
+ const blob = new Blob([JSON.stringify(stubsForExport, null, 2)], {
type: "application/json; charset=utf-8",
})
saveAs(blob, `co-metub_p${project.id}.json`)
diff --git a/app/pages/stubs/[stubId].tsx b/app/pages/stubs/[stubId].tsx
index 53ac2d7..4f710ba 100644
--- a/app/pages/stubs/[stubId].tsx
+++ b/app/pages/stubs/[stubId].tsx
@@ -21,9 +21,7 @@ import { CopyToClipboard } from "react-copy-to-clipboard"
import formatXml from "xml-formatter"
import { saveAs } from "file-saver"
-const BreadCrumb = ({ stub }) => {
- const [project] = useQuery(getProject, { id: stub.projectId })
-
+const BreadCrumb = ({ stub, project }) => {
return (
>}>
@@ -46,8 +44,7 @@ const BreadCrumb = ({ stub }) => {
)
}
-const CopyUrlButton = ({ stub }) => {
- const [project] = useQuery(getProject, { id: stub.projectId })
+const CopyUrlButton = ({ stub, project }) => {
return (
>}>
{
const stubId = useParam("stubId", "number")
const [deleteStubMutation] = useMutation(deleteStub)
const [stub] = useQuery(getStub, { id: stubId })
+ const [project] = useQuery(getProject, { id: stub.projectId })
return (
-
+
Stub
-
+