Skip to content

Commit

Permalink
Added authenticated route and initial function to
Browse files Browse the repository at this point in the history
retrieve list of RSC User assessments.
  • Loading branch information
hawkishpolicy committed Apr 12, 2024
1 parent 6d9b0e0 commit 69c924c
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 8 deletions.
2 changes: 1 addition & 1 deletion backend/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
FROM node:18-alpine3.17
USER root

RUN apk update && apk upgrade
RUN apk update && apk upgrade && apk add --no-cache g++ make py3-pip

WORKDIR /app
COPY ./package* ./
Expand Down
4 changes: 4 additions & 0 deletions backend/src/api/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import * as savedSearches from './saved-searches';
import rateLimit from 'express-rate-limit';
import { createProxyMiddleware } from 'http-proxy-middleware';
import { UserType } from '../models';
import * as assessments from './assessments';

if (
(process.env.IS_OFFLINE || process.env.IS_LOCAL) &&
Expand Down Expand Up @@ -450,6 +451,9 @@ authenticatedRoute.put(
handlerToExpress(users.registrationDenial)
);

//Authenticated ReadySetCyber Routes
authenticatedRoute.get('/assessments', handlerToExpress(assessments.list));

//************* */
// V2 Routes //
//************* */
Expand Down
29 changes: 22 additions & 7 deletions frontend/src/components/ReadySetCyber/RSCDashboard.tsx
Original file line number Diff line number Diff line change
@@ -1,16 +1,31 @@
import React from 'react';
import React, { useEffect, useCallback, useState } from 'react';
import Box from '@mui/material/Box';
import Grid from '@mui/material/Grid';
import Stack from '@mui/material/Stack';
import Divider from '@mui/material/Divider';
import { RSCSideNav } from './RSCSideNav';
import { RSCResult } from './RSCResult';
// import { RSCResult } from './RSCResult';
import { useAuthContext } from 'context';

import { dummyResults } from './dummyData';
export const RSCDashboard: React.FC = () => {
const { user, apiGet } = useAuthContext();

const results = dummyResults;
const [results, setResults] = React.useState([]);

const fetchResults = useCallback(async () => {
try {
const data = await apiGet('/assessments');
console.log(data);
setResults(data);
} catch (e) {
console.error(e);
}
}, [apiGet]);

useEffect(() => {
fetchResults();
}, []);

export const RSCDashboard: React.FC = () => {
return (
<Box sx={{ flexGrow: 1, padding: 2 }}>
<Grid container spacing={2}>
Expand All @@ -34,7 +49,7 @@ export const RSCDashboard: React.FC = () => {
platform, for free vulnerability scanning services to kickstart
or enhance your cybersecurity measures.
</p>
{results.map((result) => (
{/* {results.map((result) => (
<Stack key={result.id} spacing={2}>
<RSCResult
id={result.id}
Expand All @@ -45,7 +60,7 @@ export const RSCDashboard: React.FC = () => {
/>
<Divider />
</Stack>
))}
))} */}
</Stack>
</Box>
</Grid>
Expand Down

0 comments on commit 69c924c

Please sign in to comment.