refactor(frontend): replace status string literals with constants
- Create constants/statuses.js with MATCH_STATUS, SUGGESTION_STATUS, MATCH_FILTER - Update MatchCard, MatchesPage, HistoryPage, RatePartnerPage to use MATCH_STATUS - Update RecordingTab to use SUGGESTION_STATUS - Update Navbar to use MATCH_STATUS for API calls
This commit is contained in:
@@ -3,6 +3,7 @@ import { useParams, useNavigate } from 'react-router-dom';
|
||||
import Layout from '../components/layout/Layout';
|
||||
import { matchesAPI } from '../services/api';
|
||||
import { Star, Loader2 } from 'lucide-react';
|
||||
import { MATCH_STATUS } from '../constants';
|
||||
|
||||
const RatePartnerPage = () => {
|
||||
const { slug } = useParams();
|
||||
@@ -24,7 +25,7 @@ const RatePartnerPage = () => {
|
||||
setMatch(result.data);
|
||||
|
||||
// Check if this match can be rated
|
||||
if (result.data.status !== 'accepted' && result.data.status !== 'completed') {
|
||||
if (result.data.status !== MATCH_STATUS.ACCEPTED && result.data.status !== MATCH_STATUS.COMPLETED) {
|
||||
alert('This match must be accepted before rating.');
|
||||
navigate('/matches');
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user