types import error fixed

This commit is contained in:
echo 2026-02-04 20:37:46 +01:00
parent c6e602d354
commit cb2355adcd
8 changed files with 39 additions and 8 deletions

View File

@ -1,4 +1,4 @@
import React from 'react';
import { useAuth } from '../../../contexts/AuthContext';
import { useReactionCounts, useUserReaction, useAddReaction } from '../../../queries/comments';
import { Button } from '../../ui/button';

View File

@ -1,4 +1,4 @@
import React from 'react';
import { Link } from '@tanstack/react-router';
import { useAuth } from '../../contexts/AuthContext';
import { Button } from '../ui/button';

View File

@ -1,4 +1,4 @@
import React, { useState } from 'react';
import { useState } from 'react';
import { LoginForm } from '../auth/LoginForm';
import { RegisterForm } from '../auth/RegisterForm';
import { useAuth } from '../../contexts/AuthContext';

View File

@ -1,7 +1,8 @@
/* eslint-disable react-refresh/only-export-components */
import React, { createContext, useContext, useState, useEffect, ReactNode } from 'react';
import { createContext, useContext, useState, useEffect } from 'react';
import type { ReactNode } from 'react';
import * as api from '../lib/api';
import { User } from '@/types';
import type { User } from '@/types';
interface AuthContextType {
user: User | null;

View File

@ -13,7 +13,7 @@ export function useCreateComment() {
return useMutation({
mutationFn: api.createComment,
onSuccess: (data, variables) => {
onSuccess: (_data, variables) => {
queryClient.invalidateQueries({
queryKey: ['comments', { articleId: variables.articleId }]
});

View File

@ -1,4 +1,4 @@
import { createRootRoute, createRoute, createRouter, Outlet } from '@tanstack/react-router'
import { createRootRoute, createRoute, createRouter, Outlet, Link } from '@tanstack/react-router'
import { ArticleTicker } from './components/ArticleTicker'
import { ArticlesComponent } from './components/routes/ArticlesComponent'
import { ArticleDetailComponent } from './components/routes/ArticleDetailComponent'

View File

@ -1 +1 @@
export * from './auth';
export type { User, UserRole, LoginDto, RegisterDto, AuthResponse, ApiError } from './auth';

30
test-article.html Normal file
View File

@ -0,0 +1,30 @@
<!DOCTYPE html>
<html>
<head>
<title>Test Article API</title>
<script>
async function testAPI() {
try {
const response = await fetch('http://localhost:3000/api/v1/articles?status=published');
const data = await response.json();
document.getElementById('result').innerHTML = `
<h2>API Test Result</h2>
<p>Status: ${response.status}</p>
<p>Articles found: ${data.total}</p>
<pre>${JSON.stringify(data.data[0], null, 2)}</pre>
`;
} catch (error) {
document.getElementById('result').innerHTML = `
<h2>Error</h2>
<p>${error.message}</p>
`;
}
}
window.onload = testAPI;
</script>
</head>
<body>
<h1>Testing Article API</h1>
<div id="result">Loading...</div>
</body>
</html>