Skip to content

Commit

Permalink
navigate to home after creating a new ticket
Browse files Browse the repository at this point in the history
  • Loading branch information
tellmoh committed Dec 24, 2021
1 parent 95d14e4 commit 6d694d2
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/user-dashboard/app/src/routes/AddTicket.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { __ } from '@wordpress/i18n';
import { useContext, useState } from 'react'
import { TicketContext } from '../contexts/TicketContext'
import { Outlet, Link } from "react-router-dom";
import { Outlet, Link, useNavigate } from "react-router-dom";
import { styled } from '@mui/material/styles';
import Button from '@mui/material/Button';
import TextEditor from '../components/editor/Editor';
Expand Down Expand Up @@ -36,6 +36,8 @@ const AddTicket = () => {
types.push({ value: type.id, label: type.name });
})

let navigate = useNavigate()

const handleSubmit = (e) => {
e.preventDefault()

Expand All @@ -57,6 +59,7 @@ const AddTicket = () => {
setTitle([])
setDesc([])
document.querySelector(".helpdesk-editor .ProseMirror").innerHTML = '';
navigate("/", { replace: true })
}

const handleTitleChange = (e) => {
Expand Down

0 comments on commit 6d694d2

Please sign in to comment.