routesync 1.0.6 → 1.0.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.js +7 -3
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -8831,12 +8831,16 @@ var MswGenerator = class {
|
|
|
8831
8831
|
const mswMethod = route.method.toLowerCase();
|
|
8832
8832
|
const mswPath = manifest.baseURL + route.path.replace(/\{([^}]+)\}/g, ":$1");
|
|
8833
8833
|
const actionName = toMethodName(route);
|
|
8834
|
-
lines.push(" http." + mswMethod + "('" + mswPath + "', async ({ request
|
|
8834
|
+
lines.push(" http." + mswMethod + "('" + mswPath + "', async ({ request, params }) => {");
|
|
8835
8835
|
lines.push(` await delay(300) // Simulated network latency`);
|
|
8836
|
+
lines.push(` const url = new URL(request.url)`);
|
|
8836
8837
|
lines.push(` return HttpResponse.json({`);
|
|
8837
8838
|
lines.push(` success: true,`);
|
|
8838
|
-
lines.push(` message: 'Mocked response for ${actionName}',`);
|
|
8839
|
-
lines.push(` data: {
|
|
8839
|
+
lines.push(` message: 'Mocked response for ${actionName} at ' + url.pathname,`);
|
|
8840
|
+
lines.push(` data: {`);
|
|
8841
|
+
lines.push(` params,`);
|
|
8842
|
+
lines.push(` // TODO: Add mock data based on your schema`);
|
|
8843
|
+
lines.push(` }`);
|
|
8840
8844
|
lines.push(` })`);
|
|
8841
8845
|
lines.push(` }),`);
|
|
8842
8846
|
}
|