change list invoce and tickets + pwa + ...
This commit is contained in:
@@ -14,13 +14,14 @@ const TicketList: FC = () => {
|
||||
const { t } = useTranslation('global')
|
||||
const [searchParams] = useSearchParams()
|
||||
const [customerId, setCustomerId] = useState<string>('')
|
||||
const [activeTab, setActiveTab] = useState<'ANSWERED' | 'PENDING' | 'CLOSED'>('PENDING')
|
||||
const [activeTab, setActiveTab] = useState<'ANSWERED' | 'PENDING' | 'CLOSED' | ''>('PENDING')
|
||||
const getTicket = useGetTickets(activeTab, customerId)
|
||||
|
||||
useEffect(() => {
|
||||
const urlCustomerId = searchParams.get('user')
|
||||
if (urlCustomerId) {
|
||||
setCustomerId(urlCustomerId)
|
||||
setActiveTab('')
|
||||
}
|
||||
}, [searchParams])
|
||||
|
||||
|
||||
@@ -2,11 +2,11 @@ import axios from "../../../config/axios";
|
||||
import { AddMessageTicketType, CreateCategoryType } from "../types/TicketTypes";
|
||||
|
||||
export const getTickets = async (status: string, customerId?: string) => {
|
||||
let query = `/tickets/admin?status=${status}`;
|
||||
if (customerId) {
|
||||
query += `&userId=${customerId}`;
|
||||
}
|
||||
const { data } = await axios.get(query);
|
||||
const params = new URLSearchParams();
|
||||
if (status) params.append("status", status);
|
||||
if (customerId) params.append("userId", customerId);
|
||||
const query = params.toString();
|
||||
const { data } = await axios.get(`/tickets/admin?${query}`);
|
||||
return data;
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user