Refactor manifest.json paths, enhance teams fetching logic, and improve results display handling

This commit is contained in:
Naveen Kumar 2025-04-22 12:30:15 +05:30
parent 08d1f2cb63
commit f0f4418cf0
5 changed files with 56 additions and 47 deletions

View File

@ -3,17 +3,17 @@
"name": "Kings Admin Panel",
"icons": [
{
"src": "favicon.ico",
"src": "/favicon.ico",
"sizes": "64x64 32x32 24x24 16x16",
"type": "image/x-icon"
},
{
"src": "logo192.png",
"src": "/logo192.png",
"type": "image/png",
"sizes": "192x192"
},
{
"src": "logo512.png",
"src": "/logo512.png",
"type": "image/png",
"sizes": "512x512"
}

View File

@ -11,7 +11,7 @@ import 'react-toastify/dist/ReactToastify.css';
const root = ReactDOM.createRoot(document.getElementById('root'));
root.render(
<React.StrictMode>
<BrowserRouter>
<BrowserRouter future={{ v7_relativeSplatPath: true }}>
<AuthProvider>
<App />
<ToastContainer position="top-right" autoClose={3000} />

View File

@ -35,9 +35,10 @@ const Results = () => {
const fetchTeams = async () => {
try {
const data = await teamsService.getAll();
setTeams(data);
setTeams(Array.isArray(data) ? data : []); // Ensure teams is always an array
} catch (err) {
console.error('Error fetching teams:', err);
setTeams([]); // Fallback to an empty array on error
}
};
@ -236,7 +237,12 @@ const Results = () => {
</tr>
</thead>
<tbody>
{results.map((result, index) => (
{results.length === 0 ? (
<tr>
<td colSpan="6" className="text-center">No results found with the current filter.</td>
</tr>
) : (
results.map((result, index) => (
<tr key={result.id}>
<td>{index + 1}</td>
<td>{result.team || result.team_name}</td>
@ -275,7 +281,8 @@ const Results = () => {
</Button>
</td>
</tr>
))}
))
)}
</tbody>
</Table>
)}

View File

@ -142,11 +142,11 @@ const Teams = () => {
</tr>
</thead>
<tbody>
{teams.map((team, index) => (
{Array.isArray(teams) && teams.map((team, index) => (
<tr key={team.id}>
<td>{index + 1}</td>
<td>{team.name}</td>
<td>{new Date(team.created_at).toLocaleString('en-IN', {timeZone: 'Asia/Kolkata'})}</td>
<td>{new Date(team.created_at).toLocaleString('en-IN', { timeZone: 'Asia/Kolkata' })}</td>
<td>
<Button
variant="outline-primary"

View File

@ -1,8 +1,10 @@
import axios from 'axios';
const API_URL = process.env.REACT_APP_API_URL;
// const API_URL = process.env.REACT_APP_API_URL;
const TOKEN_KEY = process.env.REACT_APP_TOKEN_KEY;
const API_URL = 'https://backend.matkasattadaily.com'
const http = axios.create({
baseURL: API_URL,
headers: {