Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
C
cms
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Pedro-dev_2
cms
Commits
69f213a4
Commit
69f213a4
authored
Apr 24, 2021
by
PDuarte
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
show save result
parent
ac19ac50
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
41 additions
and
12 deletions
+41
-12
projectCard.js
src/views/settings/projects/edit/projectCard.js
+21
-7
index.js
src/views/settings/store/actions/index.js
+13
-3
index.js
src/views/settings/store/reducer/index.js
+7
-2
No files found.
src/views/settings/projects/edit/projectCard.js
View file @
69f213a4
// ** React Imports
import
{
useState
,
useEffect
,
Fragment
}
from
'react'
import
{
useDispatch
}
from
'react-redux'
import
{
use
Selector
,
use
Dispatch
}
from
'react-redux'
import
{
toast
}
from
'react-toastify'
import
Avatar
from
'@components/avatar'
...
...
@@ -12,7 +12,7 @@ import { Bell, Check, X, AlertTriangle, Info } from 'react-feather'
// ** Store & Actions
import
{
updateProject
}
from
'../../store/actions'
import
{
updateProject
,
resetResults
}
from
'../../store/actions'
import
{
useForm
}
from
'react-hook-form'
import
classnames
from
'classnames'
...
...
@@ -28,7 +28,7 @@ const SuccessProgressToast = () => (
<
div
className
=
'toastify-header'
>
<
div
className
=
'title-wrapper'
>
<
Avatar
size
=
'sm'
color
=
'success'
icon
=
{
<
Check
size
=
{
12
}
/>} /
>
<
h6
className
=
'toast-title'
>
Sav
ing
Project
!<
/h6
>
<
h6
className
=
'toast-title'
>
Sav
ed
!<
/h6
>
<
/div
>
<
small
className
=
'text-muted'
><
/small
>
<
/div
>
...
...
@@ -42,13 +42,15 @@ const SuccessProgressToast = () => (
const
ProjectCard
=
({
selectedProject
})
=>
{
const
store
=
useSelector
(
state
=>
state
.
projectsettings
)
const
MySwal
=
withReactContent
(
Swal
)
const
handleError
=
()
=>
{
const
handleError
=
(
text
)
=>
{
return
MySwal
.
fire
({
title
:
'Error!'
,
text
:
' You clicked the button!'
,
text
,
icon
:
'error'
,
customClass
:
{
confirmButton
:
'btn btn-primary'
...
...
@@ -63,8 +65,6 @@ const handleError = () => {
notifySuccessProgress
=
()
=>
toast
.
success
(
<
SuccessProgressToast
/>
),
onSubmit
=
values
=>
{
if
(
isObjEmpty
(
errors
))
{
notifySuccessProgress
()
// handleError()
dispatch
(
updateProject
({
id
:
values
.
id
,
...
...
@@ -82,6 +82,20 @@ const handleError = () => {
}
},
[
selectedProject
])
useEffect
(()
=>
{
if
(
store
.
errorMsg
!==
''
)
{
handleError
(
store
.
errorMsg
)
dispatch
(
resetResults
())
}
},
[
store
.
errorMsg
])
useEffect
(()
=>
{
if
(
store
.
saveSucces
)
{
notifySuccessProgress
()
dispatch
(
resetResults
())
}
},
[
store
.
saveSucces
])
return
(
<
Fragment
>
...
...
src/views/settings/store/actions/index.js
View file @
69f213a4
...
...
@@ -80,6 +80,16 @@ export const cleanProject = id => {
}
}
export
const
resetResults
=
id
=>
{
return
async
dispatch
=>
{
dispatch
({
type
:
'RESET_RESULTS'
,
saveSucces
:
false
,
errorMsg
:
''
})
}
}
// ** Add new project
export
const
updateProject
=
project
=>
{
return
(
dispatch
,
getState
)
=>
{
...
...
@@ -97,14 +107,14 @@ export const updateProject = project => {
// dispatch(getData_projects())
})
.
catch
(
err
=>
{
dispatch
(
setErrorMsg
(
'error'
))
console
.
log
(
err
)
dispatch
(
setErrorMsg
(
err
.
response
.
data
.
message
))
console
.
log
(
err
.
response
.
data
)
})
}
}
// ** Get table Data
///api/datatables/data
// ** Get table Data
platforms
export
const
getData_platforms
=
params
=>
{
return
async
dispatch
=>
{
await
axios
.
get
(
`
${
process
.
env
.
REACT_APP_API
}
/api/platforms`
,
params
...
...
src/views/settings/store/reducer/index.js
View file @
69f213a4
...
...
@@ -40,8 +40,13 @@ const settings = (state = initialState, action) => {
return
{
...
state
,
errorMsg
:
action
.
errorMsg
}
}
case
'RESET_RESULTS'
:
return
{
...
state
,
saveSucces
:
false
,
errorMsg
:
''
}
case
'GET_DATA_PROJECTS'
:
...
...
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