feat: redirect to home page after saving
This commit is contained in:
@@ -8,6 +8,7 @@ import { TextField, Typography } from "@mui/material";
|
|||||||
import { WarningText } from "../atoms/texts";
|
import { WarningText } from "../atoms/texts";
|
||||||
import NotificationImportantIcon from "@mui/icons-material/NotificationImportant";
|
import NotificationImportantIcon from "@mui/icons-material/NotificationImportant";
|
||||||
import FlagIcon from '@mui/icons-material/Flag';
|
import FlagIcon from '@mui/icons-material/Flag';
|
||||||
|
import { useNavigate } from 'react-router-dom'; // Import useNavigate
|
||||||
|
|
||||||
interface SaveRecordingProps {
|
interface SaveRecordingProps {
|
||||||
fileName: string;
|
fileName: string;
|
||||||
@@ -22,6 +23,7 @@ export const SaveRecording = ({ fileName }: SaveRecordingProps) => {
|
|||||||
|
|
||||||
const { browserId, setBrowserId, notify, recordings } = useGlobalInfoStore();
|
const { browserId, setBrowserId, notify, recordings } = useGlobalInfoStore();
|
||||||
const { socket } = useSocketStore();
|
const { socket } = useSocketStore();
|
||||||
|
const navigate = useNavigate();
|
||||||
|
|
||||||
const handleChangeOfTitle = (event: React.ChangeEvent<HTMLInputElement>) => {
|
const handleChangeOfTitle = (event: React.ChangeEvent<HTMLInputElement>) => {
|
||||||
const { value } = event.target;
|
const { value } = event.target;
|
||||||
@@ -47,6 +49,7 @@ export const SaveRecording = ({ fileName }: SaveRecordingProps) => {
|
|||||||
await stopRecording(browserId);
|
await stopRecording(browserId);
|
||||||
}
|
}
|
||||||
setBrowserId(null);
|
setBrowserId(null);
|
||||||
|
navigate('/');
|
||||||
}, [setBrowserId, browserId, notify]);
|
}, [setBrowserId, browserId, notify]);
|
||||||
|
|
||||||
// notifies backed to save the recording in progress,
|
// notifies backed to save the recording in progress,
|
||||||
|
|||||||
Reference in New Issue
Block a user