fix projects
This commit is contained in:
parent
359576e045
commit
1e68ffb63f
|
|
@ -5,6 +5,7 @@ import { useAppDispatch } from 'app/store/store';
|
|||
import apiService from 'app/store/apiService';
|
||||
import ExtendedMockAdapter from './ExtendedMockAdapter';
|
||||
import { authApiMocks } from './api/auth-api';
|
||||
import { projectDashboardApiMocks } from './api/dashboards/project-api';
|
||||
|
||||
const mockAdapterOptions = {
|
||||
delayResponse: 0
|
||||
|
|
@ -26,7 +27,7 @@ function MockAdapterProvider(props: MockAdapterProviderProps) {
|
|||
const isInitialMount = useRef(true);
|
||||
useEffect(() => {
|
||||
const setupAllMocks = () => {
|
||||
[authApiMocks].forEach((mockSetup) => {
|
||||
[authApiMocks, projectDashboardApiMocks].forEach((mockSetup) => {
|
||||
mockSetup(mock);
|
||||
});
|
||||
};
|
||||
|
|
|
|||
|
|
@ -0,0 +1,10 @@
|
|||
import mockApi from '../../mock-api.json';
|
||||
import ExtendedMockAdapter from '../../ExtendedMockAdapter';
|
||||
|
||||
const widgets = mockApi.components.examples.analytics_dashboard_widgets.value;
|
||||
|
||||
export const analyticsDashboardApiMocks = (mock: ExtendedMockAdapter) => {
|
||||
mock.onGet('/dashboards/analytics/widgets').reply(() => {
|
||||
return [200, widgets];
|
||||
});
|
||||
};
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
import mockApi from '../../mock-api.json';
|
||||
import ExtendedMockAdapter from '../../ExtendedMockAdapter';
|
||||
|
||||
const widgets = mockApi.components.examples.crypto_dashboard_widgets.value;
|
||||
|
||||
export const cryptoDashboardApiMocks = (mock: ExtendedMockAdapter) => {
|
||||
mock.onGet('/dashboards/crypto/widgets').reply(() => {
|
||||
return [200, widgets];
|
||||
});
|
||||
};
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
import mockApi from '../../mock-api.json';
|
||||
import ExtendedMockAdapter from '../../ExtendedMockAdapter';
|
||||
|
||||
const widgets = mockApi.components.examples.finance_dashboard_widgets.value;
|
||||
|
||||
export const financeDashboardApiMocks = (mock: ExtendedMockAdapter) => {
|
||||
mock.onGet('/dashboards/finance/widgets').reply(() => {
|
||||
return [200, widgets];
|
||||
});
|
||||
};
|
||||
|
|
@ -0,0 +1,15 @@
|
|||
import mockApi from '../../mock-api.json';
|
||||
import ExtendedMockAdapter from '../../ExtendedMockAdapter';
|
||||
|
||||
const widgets = mockApi.components.examples.project_dashboard_widgets.value;
|
||||
const projects = mockApi.components.examples.project_dashboard_projects.value;
|
||||
|
||||
export const projectDashboardApiMocks = (mock: ExtendedMockAdapter) => {
|
||||
mock.onGet('/dashboards/project/widgets').reply(() => {
|
||||
return [200, widgets];
|
||||
});
|
||||
|
||||
mock.onGet('/dashboards/project/projects').reply(() => {
|
||||
return [200, projects];
|
||||
});
|
||||
};
|
||||
|
|
@ -1,6 +1,5 @@
|
|||
import Avatar from '@mui/material/Avatar';
|
||||
import Menu from '@mui/material/Menu';
|
||||
import MenuItem from '@mui/material/MenuItem';
|
||||
import Typography from '@mui/material/Typography';
|
||||
import { useState } from 'react';
|
||||
import _ from '@lodash';
|
||||
|
|
@ -10,33 +9,14 @@ import FuseLoading from '@fuse/core/FuseLoading';
|
|||
import { darken } from '@mui/material/styles';
|
||||
import { useSelector } from 'react-redux';
|
||||
import { selectUser } from 'src/app/auth/user/store/userSlice';
|
||||
import MenuItem from '@mui/material/MenuItem';
|
||||
import { useGetProjectDashboardProjectsQuery } from './ProjectDashboardApi';
|
||||
|
||||
/**
|
||||
* The ProjectDashboardAppHeader page.
|
||||
*/
|
||||
function ProjectDashboardAppHeader() {
|
||||
const { isLoading } = useGetProjectDashboardProjectsQuery();
|
||||
|
||||
|
||||
const projects=[
|
||||
{
|
||||
"id": 1,
|
||||
"name": "ACME Corp. Backend App"
|
||||
},
|
||||
{
|
||||
"id": 2,
|
||||
"name": "ACME Corp. Frontend App"
|
||||
},
|
||||
{
|
||||
"id": 3,
|
||||
"name": "Creapond"
|
||||
},
|
||||
{
|
||||
"id": 4,
|
||||
"name": "Withinpixels"
|
||||
}
|
||||
]
|
||||
const { data: projects, isLoading } = useGetProjectDashboardProjectsQuery();
|
||||
|
||||
const user = useSelector(selectUser);
|
||||
|
||||
|
|
@ -150,7 +130,7 @@ function ProjectDashboardAppHeader() {
|
|||
open={Boolean(selectedProject.menuEl)}
|
||||
onClose={handleCloseProjectMenu}
|
||||
>
|
||||
{/* {projects &&
|
||||
{projects &&
|
||||
projects.map((project) => (
|
||||
<MenuItem
|
||||
key={project.id}
|
||||
|
|
@ -160,7 +140,7 @@ function ProjectDashboardAppHeader() {
|
|||
>
|
||||
{project.name}
|
||||
</MenuItem>
|
||||
))} */}
|
||||
))}
|
||||
</Menu>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
Loading…
Reference in New Issue