Skip to content

Commit

Permalink
fix: set session id in context
Browse files Browse the repository at this point in the history
  • Loading branch information
gregfrasco committed May 7, 2023
1 parent da6780d commit 2c5290e
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions client/src/components/session-manage/session-manage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import { AppState } from '@utils/data-format';
import { useSelector, useDispatch } from 'react-redux';
import { setSessionId, setPrime } from '../../redux/session';
import { useNavigate } from 'react-router-dom';
import { useSession } from '@context/session.context';

const validationSchema = Yup.object().shape({
submissionId: Yup.string().required('Please input the 26-character BWWC 2023 Submission ID.').length(26, 'Submission ID must be 26 characters long.')
Expand All @@ -25,6 +26,7 @@ export const SessionManage: FC = () => {
const urlParams = new URLSearchParams(window.location.search);
const { sessionId, authToken } = useSelector((state: AppState) => state.session);
const navigate = useNavigate();
const { setSessionId: setSessionIdContext } = useSession();
const [initialValues, setInitialValues] = useState({
submissionId: sessionId
});
Expand All @@ -43,6 +45,7 @@ export const SessionManage: FC = () => {
async function updateIDandPrime() {
setSessionId(values.submissionId);
if (values.submissionId !== '') {
setSessionIdContext(values.submissionId);
dispatch(setSessionId(values.submissionId));
const prime = await getPrime(sessionId);
setPrime(prime);
Expand Down

0 comments on commit 2c5290e

Please sign in to comment.