Merge pull request 'changed query to our api' (#156) from fix/search-request into develop
Reviewed-on: http://85.143.176.51:3000/free-land/front-end/pulls/156
This commit is contained in:
commit
1817946fe6
@ -3,16 +3,19 @@ import { Article } from "../domain/articleEntity";
|
|||||||
import { create } from "../domain/articleModel";
|
import { create } from "../domain/articleModel";
|
||||||
import { FetchArticleByIdDTO } from "./dto/fetch_article_by_id_dto";
|
import { FetchArticleByIdDTO } from "./dto/fetch_article_by_id_dto";
|
||||||
import Failure from "core/failure";
|
import Failure from "core/failure";
|
||||||
|
import { integratorApiClient } from "core/httpClient";
|
||||||
|
|
||||||
|
const articleEndpoint = "/papers/"
|
||||||
|
|
||||||
async function getArticle(id: string): Promise<Article> {
|
async function getArticle(id: string): Promise<Article> {
|
||||||
try {
|
try {
|
||||||
// await new Promise((res, _) => {
|
// await new Promise((res, _) => {
|
||||||
// setTimeout(() => res(null), 2000);
|
// setTimeout(() => res(null), 2000);
|
||||||
// });
|
// });
|
||||||
const response = await axios.get<FetchArticleByIdDTO>(
|
const response = await integratorApiClient.get<FetchArticleByIdDTO>(
|
||||||
`https://run.mocky.io/v3/62cd4581-d864-4d46-b1d6-02b45b5d1994/${id}`
|
// `https://run.mocky.io/v3/62cd4581-d864-4d46-b1d6-02b45b5d1994/${id}`
|
||||||
// `https://jsonplaceholder.typicode.com/posts/${id}`
|
// `https://jsonplaceholder.typicode.com/posts/${id}`
|
||||||
// `http://scipaper.ru/v1/papers/${id}`
|
articleEndpoint + id
|
||||||
);
|
);
|
||||||
const dto = response.data;
|
const dto = response.data;
|
||||||
return create({
|
return create({
|
||||||
|
@ -10,8 +10,8 @@ const searchEndpoint = "/papers/search";
|
|||||||
async function search(request: string): Promise<SearchResults> {
|
async function search(request: string): Promise<SearchResults> {
|
||||||
try {
|
try {
|
||||||
const response = await integratorApiClient.get<SearchResultsDTO>(
|
const response = await integratorApiClient.get<SearchResultsDTO>(
|
||||||
// searchEndpoint + `?query=` + request
|
searchEndpoint + `?query=` + request
|
||||||
"https://run.mocky.io/v3/ea705665-2479-4039-8b81-412e011fc145"
|
// "https://run.mocky.io/v3/ea705665-2479-4039-8b81-412e011fc145"
|
||||||
);
|
);
|
||||||
const dto = response.data;
|
const dto = response.data;
|
||||||
return create({
|
return create({
|
||||||
|
Loading…
x
Reference in New Issue
Block a user