File tree Expand file tree Collapse file tree 3 files changed +12
-9
lines changed
Expand file tree Collapse file tree 3 files changed +12
-9
lines changed Original file line number Diff line number Diff line change @@ -67,11 +67,11 @@ const users = await mockmate({
6767### Different sources
6868
6969``` ts
70- const users = await mockmate ({
71- category: " users" ,
72- source: " fakestoreapi" , // source: "jsonplaceholder"
73- quantity: 2 ,
74- });
70+ const users = await mockmate ({
71+ category: " users" ,
72+ source: " fakestoreapi" , // source: "jsonplaceholder"
73+ quantity: 2 ,
74+ });
7575```
7676
7777### Generate Schema
Original file line number Diff line number Diff line change @@ -3,7 +3,10 @@ import { SourceFetchError } from "./errors.js";
33import axios from "axios" ;
44import { getBaseUrl } from "../utils/config.js" ;
55
6- export async function fetchData ( category : DataCategory , source : DataSource = "jsonplaceholder" ) {
6+ export async function fetchData (
7+ category : DataCategory ,
8+ source : DataSource = "jsonplaceholder"
9+ ) {
710 try {
811 const baseUrl = getBaseUrl ( source ) ;
912 const response = await axios . get ( `${ baseUrl } /${ category } ` ) ;
Original file line number Diff line number Diff line change 11import type { DataSource } from "../core/types" ;
22
33export const SOURCE_URLS : Record < DataSource , string > = {
4- jsonplaceholder : "https://jsonplaceholder.typicode.com" ,
5- fakestoreapi : "https://fakestoreapi.com"
4+ jsonplaceholder : "https://jsonplaceholder.typicode.com" ,
5+ fakestoreapi : "https://fakestoreapi.com" ,
66} ;
77
88export const BASE_URL = SOURCE_URLS . jsonplaceholder ;
99
1010export function getBaseUrl ( source : DataSource ) : string {
11- return SOURCE_URLS [ source ] ;
11+ return SOURCE_URLS [ source ] ;
1212}
You can’t perform that action at this time.
0 commit comments