Commit ac19ac50 authored by PDuarte's avatar PDuarte

clear selected project

parent e79c85e0
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
import { Link } from 'react-router-dom' import { Link } from 'react-router-dom'
// ** Store & Actions // ** Store & Actions
import { getProject } from '../store/actions' import { getProject, cleanProject } from '../store/actions'
import { store } from '@store/storeConfig/store' import { store } from '@store/storeConfig/store'
// ** Custom Components // ** Custom Components
...@@ -259,7 +259,7 @@ export const serverSideColumns = [ ...@@ -259,7 +259,7 @@ export const serverSideColumns = [
<Link <Link
to={`/settings/projects/edit/${row.id}`} to={`/settings/projects/edit/${row.id}`}
className='user-name text-truncate mb-0' className='user-name text-truncate mb-0'
// onClick={() => store.dispatch(getProject(row.id))} onClick={() => store.dispatch(cleanProject(row.id))}
> >
<span className='font-weight-bold'>{row.app_name}</span> <span className='font-weight-bold'>{row.app_name}</span>
</Link> </Link>
......
...@@ -34,8 +34,8 @@ const ProjectsEdit = () => { ...@@ -34,8 +34,8 @@ const ProjectsEdit = () => {
return store.selectedProject !== null && store.selectedProject !== undefined ? ( return store.selectedProject !== null && store.selectedProject !== undefined ? (
<ProjectCard selectedProject={store.selectedProject} /> <ProjectCard selectedProject={store.selectedProject} />
) : ( ) : (
<Alert color='danger'> <Alert color='info'>
<h4 className='alert-heading'>Project not found</h4> <h4 className='alert-heading'>Loading Project</h4>
<div className='alert-body'> <div className='alert-body'>
User with id: {id} doesn't exist. Check list of all Projects: <Link to='/settings/projects'>Projects List</Link> User with id: {id} doesn't exist. Check list of all Projects: <Link to='/settings/projects'>Projects List</Link>
</div> </div>
......
...@@ -30,7 +30,7 @@ const SuccessProgressToast = () => ( ...@@ -30,7 +30,7 @@ const SuccessProgressToast = () => (
<Avatar size='sm' color='success' icon={<Check size={12} />} /> <Avatar size='sm' color='success' icon={<Check size={12} />} />
<h6 className='toast-title'>Saving Project !</h6> <h6 className='toast-title'>Saving Project !</h6>
</div> </div>
<small className='text-muted'>now</small> <small className='text-muted'></small>
</div> </div>
<div className='toastify-body'> <div className='toastify-body'>
<span role='img' aria-label='toast-text'> <span role='img' aria-label='toast-text'>
......
...@@ -71,6 +71,15 @@ export const getProject = id => { ...@@ -71,6 +71,15 @@ export const getProject = id => {
} }
} }
export const cleanProject = id => {
return async dispatch => {
dispatch({
type: 'GET_PROJECT',
data: null
})
}
}
// ** Add new project // ** Add new project
export const updateProject = project => { export const updateProject = project => {
return (dispatch, getState) => { return (dispatch, getState) => {
......
...@@ -50,12 +50,11 @@ const settings = (state = initialState, action) => { ...@@ -50,12 +50,11 @@ const settings = (state = initialState, action) => {
allDataProjects: action.allData, allDataProjects: action.allData,
dataProjects: action.data, dataProjects: action.data,
totalProjects: action.totalPages, totalProjects: action.totalPages,
selectedProject: null, // selectedProject: null,
paramsProjects: action.params paramsProjects: action.params
} }
case 'GET_PROJECT': case 'GET_PROJECT':
return { ...state, return { ...state,
selectedProject : action.data selectedProject : action.data
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment