diff --git a/src/views/home/articles/Articles.tsx b/src/views/home/articles/Articles.tsx
index b8f3cdd..13519fd 100644
--- a/src/views/home/articles/Articles.tsx
+++ b/src/views/home/articles/Articles.tsx
@@ -1,9 +1,10 @@
import { useEffect } from 'react';
import { SecondaryButton } from '../../../components/button/SecondaryButton';
-import { useAppDispatch } from '../../../redux/hooks';
+import { useAppDispatch, useAppSelector } from '../../../redux/hooks';
import ArticleItem from './ArticleItem';
import { setMenuActivePage } from '../../../redux/slices/store';
import { useNavigate } from 'react-router-dom';
+import { fetchArticles } from '../../../redux/slices/articles';
export interface Article {
id: number;
@@ -15,123 +16,16 @@ const Articles = () => {
const dispatch = useAppDispatch();
const navigate = useNavigate();
- const articles: Article[] = [
- {
- id: 1,
- name: 'Todo List App',
- tags: ['Sertificated', 'state', 'list'],
- },
- {
- id: 2,
- name: 'Search Filter Component',
- tags: ['filter', 'props', 'hooks'],
- },
- {
- id: 3,
- name: 'User Card List',
- tags: ['components', 'props', 'array'],
- },
- {
- id: 4,
- name: 'Theme Switcher',
- tags: ['Sertificated', 'theme', 'hooks'],
- },
- {
- id: 2,
- name: 'Search Filter Component',
- tags: ['filter', 'props', 'hooks'],
- },
- {
- id: 3,
- name: 'User Card List',
- tags: ['components', 'props', 'array'],
- },
- {
- id: 4,
- name: 'Theme Switcher',
- tags: ['Sertificated', 'theme', 'hooks'],
- },
- {
- id: 2,
- name: 'Search Filter Component',
- tags: ['filter', 'props', 'hooks'],
- },
- {
- id: 3,
- name: 'User Card List',
- tags: ['components', 'props', 'array'],
- },
- {
- id: 4,
- name: 'Theme Switcher',
- tags: ['Sertificated', 'theme', 'hooks'],
- },
- {
- id: 2,
- name: 'Search Filter Component',
- tags: ['filter', 'props', 'hooks'],
- },
- {
- id: 3,
- name: 'User Card List',
- tags: ['components', 'props', 'array'],
- },
- {
- id: 4,
- name: 'Theme Switcher',
- tags: ['Sertificated', 'theme', 'hooks'],
- },
- {
- id: 2,
- name: 'Search Filter Component',
- tags: ['filter', 'props', 'hooks'],
- },
- {
- id: 3,
- name: 'User Card List',
- tags: ['components', 'props', 'array'],
- },
- {
- id: 4,
- name: 'Theme Switcher',
- tags: ['Sertificated', 'theme', 'hooks'],
- },
- {
- id: 2,
- name: 'Search Filter Component',
- tags: ['filter', 'props', 'hooks'],
- },
- {
- id: 3,
- name: 'User Card List',
- tags: ['components', 'props', 'array'],
- },
- {
- id: 4,
- name: 'Theme Switcher',
- tags: ['Sertificated', 'theme', 'hooks'],
- },
- {
- id: 2,
- name: 'Search Filter Component',
- tags: ['filter', 'props', 'hooks'],
- },
- {
- id: 3,
- name: 'User Card List',
- tags: ['components', 'props', 'array'],
- },
- {
- id: 4,
- name: 'Theme Switcher',
- tags: ['Sertificated', 'theme', 'hooks'],
- },
- ];
+ const articles = useAppSelector((state) => state.articles.articles);
+ const status = useAppSelector((state) => state.articles.statuses.fetchAll);
useEffect(() => {
dispatch(setMenuActivePage('articles'));
+ dispatch(fetchArticles({}));
}, []);
+ if (status == 'loading') return
Загрузка...
;
+
return (