Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

js-20221021_maxim-b #84

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/components/column-chart/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import fetchJson from './utils/fetch-json.js';
import fetchJson from '../../utils/fetch-json.js';

const BACKEND_URL = 'https://course-js.javascript.ru';
const BACKEND_URL = process.env.BACKEND_URL;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good 👍,


export default class ColumnChart {
element;
Expand Down
6 changes: 0 additions & 6 deletions src/components/column-chart/utils/escape-html.js

This file was deleted.

56 changes: 0 additions & 56 deletions src/components/column-chart/utils/fetch-json.js

This file was deleted.

16 changes: 8 additions & 8 deletions src/components/product-form/index.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import SortableList from '../../2-sortable-list/solution';
import escapeHtml from './utils/escape-html.js';
import fetchJson from './utils/fetch-json.js';
import SortableList from '../../components/sortable-list';
import escapeHtml from '../../utils/escape-html';
import fetchJson from '../../utils/fetch-json';

const IMGUR_CLIENT_ID = '28aaa2e823b03b1';
const BACKEND_URL = 'https://course-js.javascript.ru';
const IMGUR_CLIENT_ID = process.env.IMGUR_CLIENT_ID;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good 👍

const BACKEND_URL = process.env.BACKEND_URL;

export default class ProductForm {
element;
Expand Down Expand Up @@ -213,7 +213,7 @@ export default class ProductForm {
async save() {
const product = this.getFormData();

const result = await fetchJson(`${BACKEND_URL}/api/rest/products`, {
const result = await fetchJson(`${BACKEND_URL}api/rest/products`, {
method: this.productId ? 'PATCH' : 'PUT',
headers: {
'Content-Type': 'application/json'
Expand Down Expand Up @@ -276,11 +276,11 @@ export default class ProductForm {
}

loadProductData(productId) {
return fetchJson(`${BACKEND_URL}/api/rest/products?id=${productId}`);
return fetchJson(`${BACKEND_URL}api/rest/products?id=${productId}`);
}

loadCategoriesList() {
return fetchJson(`${BACKEND_URL}/api/rest/categories?_sort=weight&_refs=subcategory`);
return fetchJson(`${BACKEND_URL}api/rest/categories?_sort=weight&_refs=subcategory`);
}

createCategoriesSelect() {
Expand Down
6 changes: 0 additions & 6 deletions src/components/product-form/utils/escape-html.js

This file was deleted.

55 changes: 0 additions & 55 deletions src/components/product-form/utils/fetch-json.js

This file was deleted.

6 changes: 3 additions & 3 deletions src/components/sortable-table/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import fetchJson from './utils/fetch-json.js';
import fetchJson from '../../utils/fetch-json';

const BACKEND_URL = 'https://course-js.javascript.ru';
const BACKEND_URL = process.env.BACKEND_URL;

export default class SortableTable {
element;
Expand Down Expand Up @@ -198,7 +198,7 @@ export default class SortableTable {
<div data-element="loading" class="loading-line sortable-table__loading-line"></div>

<div data-element="emptyPlaceholder" class="sortable-table__empty-placeholder">
No products
Товаров нет
</div>
</div>`;
}
Expand Down
6 changes: 0 additions & 6 deletions src/components/sortable-table/utils/escape-html.js

This file was deleted.

56 changes: 0 additions & 56 deletions src/components/sortable-table/utils/fetch-json.js

This file was deleted.

10 changes: 5 additions & 5 deletions src/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -20,30 +20,30 @@ <h2 class="sidebar__title">
<ul class="sidebar__nav">
<li>
<a href="/" data-page="dashboard">
<i class="icon-dashboard"></i> <span>Dashboard</span>
<i class="icon-dashboard"></i> <span>Панель управления</span>
</a>
</li>
<li>
<a href="/products" data-page="products">
<i class="icon-products"></i> <span>Products</span>
<i class="icon-products"></i> <span>Товары</span>
</a>
</li>
<li>
<a href="/categories" data-page="categories">
<i class="icon-categories"></i> <span>Categories</span>
<i class="icon-categories"></i> <span>Категории</span>
</a>
</li>
<li>
<a href="/sales" data-page="sales">
<i class="icon-sales"></i> <span>Sales</span>
<i class="icon-sales"></i> <span>Продажи</span>
</a>
</li>
</ul>
<ul class="sidebar__nav sidebar__nav_bottom">
<li>
<!-- TODO: implement toggling -->
<button type="button" class="sidebar__toggler">
<i class="icon-toggle-sidebar"></i> <span>Toggle sidebar</span>
<i class="icon-toggle-sidebar"></i> <span>Скрыть панель</span>
</button>
</li>
</ul>
Expand Down
Loading