From 17646f73f9f04002057658d7788959565d2468ec Mon Sep 17 00:00:00 2001 From: andres Date: Sun, 9 Jun 2024 14:54:19 +0200 Subject: [PATCH] initial commit --- .idea/git_toolbox_prj.xml | 15 +++++++++++++++ app/services/vacancies/vacancies.service.ts | 9 ++++++--- 2 files changed, 21 insertions(+), 3 deletions(-) create mode 100644 .idea/git_toolbox_prj.xml diff --git a/.idea/git_toolbox_prj.xml b/.idea/git_toolbox_prj.xml new file mode 100644 index 0000000..02b915b --- /dev/null +++ b/.idea/git_toolbox_prj.xml @@ -0,0 +1,15 @@ + + + + + + + \ No newline at end of file diff --git a/app/services/vacancies/vacancies.service.ts b/app/services/vacancies/vacancies.service.ts index 3be85b3..b20c13f 100644 --- a/app/services/vacancies/vacancies.service.ts +++ b/app/services/vacancies/vacancies.service.ts @@ -1,11 +1,14 @@ import { Vacancies, VacancyData } from '~/services/vacancies/vacancies.types' export class VacanciesService { + baseUrl = 'https://vacancies-trends-api.onrender.com' + async getAll(): Promise { - return await fetch('http://localhost:4321/vacancies').then(res => res.json()) + return await fetch(`${this.baseUrl}/vacancies`).then(res => res.json()) } + async getAggregateByCreatedAt(): Promise { - return await fetch('http://localhost:4321/vacancies/aggregated') + return await fetch(`${this.baseUrl}/vacancies/aggregated`) .then(res => res.json()) .then(this.formatDateOnData) } @@ -14,7 +17,7 @@ export class VacanciesService { return data.map(item => { return { ...item, - date: new Date(item.date).toLocaleTimeString('ru'), + date: new Date(item.date).toLocaleDateString('ru'), } }) }