Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
2
2022-196
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
2022-196
2022-196
Commits
7e8dfb20
Commit
7e8dfb20
authored
Nov 15, 2022
by
Dilip Wijethunga
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
News Updates
parent
66db8c57
Changes
6
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
103 additions
and
256 deletions
+103
-256
frontend/src/components/news/AddNews.js
frontend/src/components/news/AddNews.js
+6
-7
frontend/src/components/news/EditNews.js
frontend/src/components/news/EditNews.js
+3
-2
frontend/src/components/news/NewsList.js
frontend/src/components/news/NewsList.js
+7
-7
frontend/src/containers/blog-grids/BlogGridTwo.js
frontend/src/containers/blog-grids/BlogGridTwo.js
+0
-1
frontend/src/containers/blog/BlogPostContent.js
frontend/src/containers/blog/BlogPostContent.js
+87
-238
frontend/src/containers/blog/BlogcontentTwo.js
frontend/src/containers/blog/BlogcontentTwo.js
+0
-1
No files found.
frontend/src/components/news/AddNews.js
View file @
7e8dfb20
...
...
@@ -6,6 +6,7 @@ import Form from "react-validation/build/form";
import
Input
from
"
react-validation/build/input
"
;
import
NewsService
from
"
../../services/NewsService
"
;
import
{
Link
}
from
"
react-router-dom
"
;
import
CommonAuthCheck
from
"
../../services/CommonAuthCheck
"
;
// TODO: Validating registration form fields
const
requiredField
=
data
=>
{
...
...
@@ -42,13 +43,11 @@ function AddNews(props) {
"
author
"
:
author
}
NewsService
.
createNews
(
data
)
.
then
(
response
=>
{
setMessage
(
response
.
data
);
NewsService
.
createNews
(
data
).
then
(
response
=>
{
setMessage
(
response
.
data
.
data
);
setLoading
(
false
);
window
.
location
.
replace
(
"
/news-list
"
);
})
.
catch
(
error
=>
console
.
log
(
error
.
message
));
window
.
location
.
replace
(
process
.
env
.
PUBLIC_URL
+
"
/news-list
"
);
}).
catch
(
error
=>
console
.
log
(
error
.
message
));
};
return
(
...
...
@@ -152,4 +151,4 @@ function AddNews(props) {
);
}
export
default
AddNews
;
\ No newline at end of file
export
default
CommonAuthCheck
(
AddNews
);
\ No newline at end of file
frontend/src/components/news/EditNews.js
View file @
7e8dfb20
...
...
@@ -6,6 +6,7 @@ import Navbar from "../dashboard/sidebar/Navbar";
import
Form
from
"
react-validation/build/form
"
;
import
Input
from
"
react-validation/build/input
"
;
import
NewsService
from
"
../../services/NewsService
"
;
import
CommonAuthCheck
from
"
../../services/CommonAuthCheck
"
;
// TODO: Validating registration form fields
...
...
@@ -66,7 +67,7 @@ function EditNews(props) {
NewsService
.
updateNews
(
data
)
.
then
(
response
=>
{
setMessage
(
response
.
data
);
setMessage
(
response
.
data
.
data
);
setLoading
(
false
);
window
.
location
.
replace
(
"
/news-list
"
);
...
...
@@ -174,4 +175,4 @@ function EditNews(props) {
);
}
export
default
EditNews
;
export
default
CommonAuthCheck
(
EditNews
)
;
frontend/src/components/news/NewsList.js
View file @
7e8dfb20
...
...
@@ -6,6 +6,7 @@ import NewsService from "../../services/NewsService";
import
Connection
from
"
../../services/connection.json
"
;
import
Modal
from
"
react-bootstrap/Modal
"
;
import
CommonAuthCheck
from
"
../../services/CommonAuthCheck
"
;
const
FLASK_API
=
Connection
.
localAddress
+
'
/news
'
;
...
...
@@ -38,9 +39,7 @@ function NewsList(props) {
const
handleDelete
=
async
(
id
)
=>
{
await
NewsService
.
deleteNewsById
(
id
)
.
then
(
response
=>
response
.
data
)
.
then
((
data
)
=>
{
console
.
log
(
data
)
}).
catch
(
error
=>
{
.
catch
(
error
=>
{
console
.
log
(
error
.
message
);
});
}
...
...
@@ -82,6 +81,7 @@ function NewsList(props) {
<
/Modal.Footer
>
<
/Modal
>
<
div
style
=
{
divBox
}
/
>
<
h2
className
=
"
text-center
"
><
mark
>
All
News
Details
<
/mark></
h2
>
<
Container
>
<
div
>
<
Link
to
=
{
`/add-news`
}
className
=
{
'
btn btn-success text-white
'
}
>
Add
a
News
<
/Link
>
...
...
@@ -121,7 +121,7 @@ function NewsList(props) {
<
td
>
{
news
.
title
}
<
/td
>
<
td
>
{
news
.
description
}
<
/td
>
<
td
>
{
news
.
date
.
$date
}
<
/td
>
<
td
>
{
news
.
image
}
<
/td
>
<
td
>
{
(
news
.
image
).
substring
(
0
,
30
)}...
<
/td
>
<
td
><
Link
to
=
{{
pathname
:
process
.
env
.
PUBLIC_URL
+
'
/edit-news
'
,
state
:
{
...
...
@@ -132,10 +132,10 @@ function NewsList(props) {
newsAuthor
:
news
.
author
}
}}
className
=
{
'
btn btn-primary
'
}
>
Edit
<
/Link
>
className
=
{
'
btn
text-white
btn-primary
'
}
>
Edit
<
/Link
>
<
/td
>
<
td
>
<
Link
onClick
=
{()
=>
handleShow
(
news
.
_id
.
$oid
)}
className
=
{
'
btn btn-danger
'
}
>
Delete
<
/Link
>
<
Link
onClick
=
{()
=>
handleShow
(
news
.
_id
.
$oid
)}
className
=
{
'
btn
text-white
btn-danger
'
}
>
Delete
<
/Link
>
<
/td
>
<
/tr
>
))
...
...
@@ -148,4 +148,4 @@ function NewsList(props) {
);
}
export
default
NewsList
;
export
default
CommonAuthCheck
(
NewsList
)
;
frontend/src/containers/blog-grids/BlogGridTwo.js
View file @
7e8dfb20
...
...
@@ -14,7 +14,6 @@ const BlogGridTwo = () => {
.
then
(
response
=>
response
.
data
)
.
then
((
data
)
=>
{
setNewsList
(
data
);
console
.
log
(
data
);
}).
catch
(
error
=>
console
.
log
(
error
.
message
));
}
dataFetch
();
...
...
frontend/src/containers/blog/BlogPostContent.js
View file @
7e8dfb20
This diff is collapsed.
Click to expand it.
frontend/src/containers/blog/BlogcontentTwo.js
View file @
7e8dfb20
...
...
@@ -15,7 +15,6 @@ const BlogcontentTwo = () => {
.
then
(
response
=>
response
.
data
)
.
then
((
data
)
=>
{
setNewsList
(
data
);
console
.
log
(
data
);
}).
catch
(
error
=>
console
.
log
(
error
.
message
));
}
dataFetch
();
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment