fix build issues

This commit is contained in:
2024-02-21 14:45:33 +01:00
parent 72313304fe
commit 2553ab41c1
6 changed files with 6183 additions and 25 deletions

View File

@@ -1,6 +1,7 @@
import { useState, useEffect } from 'react'
import { useState, useEffect, useCallback } from 'react'
import type { NextPage } from 'next'
import Head from 'next/head'
import Link from 'next/link'
interface Source {
id: number
@@ -18,11 +19,7 @@ const SourcesManagement: NextPage = () => {
const [loading, setLoading] = useState(true)
const [filter, setFilter] = useState('pending')
useEffect(() => {
fetchSources()
}, [filter])
const fetchSources = async () => {
const fetchSources = useCallback(async () => {
try {
const response = await fetch(`/api/admin/sources?status=${filter}`)
if (response.ok) {
@@ -34,7 +31,11 @@ const SourcesManagement: NextPage = () => {
} finally {
setLoading(false)
}
}
}, [filter])
useEffect(() => {
fetchSources()
}, [fetchSources])
const updateSource = async (id: number, status: string, riskLevel: number) => {
try {
@@ -158,7 +159,7 @@ const SourcesManagement: NextPage = () => {
)}
<div style={{ marginTop: '30px' }}>
<a href="/admin" style={{
<Link href="/admin" style={{
padding: '10px 20px',
backgroundColor: '#6b7280',
color: 'white',
@@ -166,7 +167,7 @@ const SourcesManagement: NextPage = () => {
borderRadius: '6px'
}}>
Späť na dashboard
</a>
</Link>
</div>
</div>
</div>