diff --git a/index.html b/index.html
index 63d843b..ac0adef 100644
--- a/index.html
+++ b/index.html
@@ -42,7 +42,7 @@
RSS агрегатор
diff --git a/src/app.js b/src/app.js
index 8b1b30b..a16564d 100644
--- a/src/app.js
+++ b/src/app.js
@@ -1,7 +1,7 @@
import i18next from 'i18next';
import * as yup from 'yup';
import axios from 'axios';
-import validate, { proxyObj } from './utils.js';
+import validate, { createLink } from './utils.js';
import watch from './view.js';
import resources from './locales/index.js';
@@ -25,7 +25,7 @@ const state = {
isValid: false,
},
loadingProcess: {
- status: 'waiting',
+ status: 'waiting', // 'sending'
error: '',
},
posts: [],
@@ -64,7 +64,7 @@ export default () => {
watchedState.loadingProcess.state = 'sending';
validate(urlTarget, urlFeeds)
- .then(({ url }) => axios.get(proxyObj(url)))
+ .then(({ url }) => axios.get(createLink(url)))
.catch((error) => {
watchedState.form.isValid = false;
watchedState.form.errors.push(error);
diff --git a/src/frontend-project-11.code-workspace b/src/frontend-project-11.code-workspace
deleted file mode 100644
index 4592160..0000000
--- a/src/frontend-project-11.code-workspace
+++ /dev/null
@@ -1,13 +0,0 @@
-{
- "folders": [
- {
- "path": ".."
- },
- {
- "path": "../../DOM"
- }
- ],
- "settings": {
- "liveServer.settings.multiRootWorkspaceName": "frontend-project-11"
- }
-}
\ No newline at end of file
diff --git a/src/utils.js b/src/utils.js
index ea575b4..8482b63 100644
--- a/src/utils.js
+++ b/src/utils.js
@@ -11,5 +11,10 @@ const validate = (url, urlFeeds) => {
return schema.validate({ url });
};
-export const proxyObj = (url) => url;
+export const createLink = (url) => {
+ const originsUrl = new URL('https://allorigins.hexlet.app/get?');
+ originsUrl.searchParams.set('disableCache', 'true');
+ originsUrl.searchParams.set('url', url);
+ return originsUrl;
+};
export default validate;
diff --git a/src/view.js b/src/view.js
index 3127461..c6c8559 100644
--- a/src/view.js
+++ b/src/view.js
@@ -15,12 +15,13 @@ export default (elements, i18n, state) => {
});
};
const watchedState = onChange(state, (path) => {
- const { errorElement } = elements;
+ const { errorElement, input } = elements;
switch (path) {
case 'form.isValid':
renderValid();
break;
case 'form.errors':
+ input.classList.add('is-invalid');
errorElement.classList.remove('text-success');
errorElement.classList.add('text-danger');
errorElement.textContent = t('errors.invalidUrl');