feat: switch frontend indexing to code-first identifiers
This commit is contained in:
@@ -27,7 +27,7 @@ const STATUS_OPTIONS = ['open', 'in_progress', 'resolved', 'closed']
|
||||
const PRIORITY_OPTIONS = ['low', 'medium', 'high', 'critical']
|
||||
|
||||
export default function SupportDetailPage() {
|
||||
const { supportId } = useParams()
|
||||
const { supportCode } = useParams()
|
||||
const navigate = useNavigate()
|
||||
const { user } = useAuth()
|
||||
const [support, setSupport] = useState<SupportItem | null>(null)
|
||||
@@ -40,7 +40,7 @@ export default function SupportDetailPage() {
|
||||
|
||||
const fetchSupport = async () => {
|
||||
try {
|
||||
const { data } = await api.get<SupportItem>(`/supports/${supportId}`)
|
||||
const { data } = await api.get<SupportItem>(`/supports/${supportCode}`)
|
||||
setSupport(data)
|
||||
setEditForm({
|
||||
title: data.title,
|
||||
@@ -56,14 +56,14 @@ export default function SupportDetailPage() {
|
||||
|
||||
useEffect(() => {
|
||||
fetchSupport()
|
||||
}, [supportId])
|
||||
}, [supportCode])
|
||||
|
||||
const handleTake = async () => {
|
||||
if (!support) return
|
||||
setSaving(true)
|
||||
setMessage('')
|
||||
try {
|
||||
const { data } = await api.post<SupportItem>(`/supports/${supportId}/take`)
|
||||
const { data } = await api.post<SupportItem>(`/supports/${supportCode}/take`)
|
||||
setSupport(data)
|
||||
setMessage('You have taken this support ticket')
|
||||
} catch (err: any) {
|
||||
@@ -78,7 +78,7 @@ export default function SupportDetailPage() {
|
||||
setSaving(true)
|
||||
setMessage('')
|
||||
try {
|
||||
const { data } = await api.post<SupportItem>(`/supports/${supportId}/transition`, {
|
||||
const { data } = await api.post<SupportItem>(`/supports/${supportCode}/transition`, {
|
||||
status: transitionStatus,
|
||||
})
|
||||
setSupport(data)
|
||||
@@ -106,7 +106,7 @@ export default function SupportDetailPage() {
|
||||
return
|
||||
}
|
||||
|
||||
const { data } = await api.patch<SupportItem>(`/supports/${supportId}`, payload)
|
||||
const { data } = await api.patch<SupportItem>(`/supports/${supportCode}`, payload)
|
||||
setSupport(data)
|
||||
setEditMode(false)
|
||||
setMessage('Support ticket updated')
|
||||
@@ -122,7 +122,7 @@ export default function SupportDetailPage() {
|
||||
if (!confirm(`Delete support ticket ${support.support_code || support.id}? This cannot be undone.`)) return
|
||||
setSaving(true)
|
||||
try {
|
||||
await api.delete(`/supports/${supportId}`)
|
||||
await api.delete(`/supports/${supportCode}`)
|
||||
navigate(-1)
|
||||
} catch (err: any) {
|
||||
setMessage(err.response?.data?.detail || 'Failed to delete support ticket')
|
||||
|
||||
Reference in New Issue
Block a user