types import error fixed
This commit is contained in:
parent
c6e602d354
commit
cb2355adcd
@ -1,4 +1,4 @@
|
|||||||
import React from 'react';
|
|
||||||
import { useAuth } from '../../../contexts/AuthContext';
|
import { useAuth } from '../../../contexts/AuthContext';
|
||||||
import { useReactionCounts, useUserReaction, useAddReaction } from '../../../queries/comments';
|
import { useReactionCounts, useUserReaction, useAddReaction } from '../../../queries/comments';
|
||||||
import { Button } from '../../ui/button';
|
import { Button } from '../../ui/button';
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
import React from 'react';
|
|
||||||
import { Link } from '@tanstack/react-router';
|
import { Link } from '@tanstack/react-router';
|
||||||
import { useAuth } from '../../contexts/AuthContext';
|
import { useAuth } from '../../contexts/AuthContext';
|
||||||
import { Button } from '../ui/button';
|
import { Button } from '../ui/button';
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
import React, { useState } from 'react';
|
import { useState } from 'react';
|
||||||
import { LoginForm } from '../auth/LoginForm';
|
import { LoginForm } from '../auth/LoginForm';
|
||||||
import { RegisterForm } from '../auth/RegisterForm';
|
import { RegisterForm } from '../auth/RegisterForm';
|
||||||
import { useAuth } from '../../contexts/AuthContext';
|
import { useAuth } from '../../contexts/AuthContext';
|
||||||
|
|||||||
@ -1,7 +1,8 @@
|
|||||||
/* eslint-disable react-refresh/only-export-components */
|
/* 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 * as api from '../lib/api';
|
||||||
import { User } from '@/types';
|
import type { User } from '@/types';
|
||||||
|
|
||||||
interface AuthContextType {
|
interface AuthContextType {
|
||||||
user: User | null;
|
user: User | null;
|
||||||
|
|||||||
@ -13,7 +13,7 @@ export function useCreateComment() {
|
|||||||
|
|
||||||
return useMutation({
|
return useMutation({
|
||||||
mutationFn: api.createComment,
|
mutationFn: api.createComment,
|
||||||
onSuccess: (data, variables) => {
|
onSuccess: (_data, variables) => {
|
||||||
queryClient.invalidateQueries({
|
queryClient.invalidateQueries({
|
||||||
queryKey: ['comments', { articleId: variables.articleId }]
|
queryKey: ['comments', { articleId: variables.articleId }]
|
||||||
});
|
});
|
||||||
|
|||||||
@ -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 { ArticleTicker } from './components/ArticleTicker'
|
||||||
import { ArticlesComponent } from './components/routes/ArticlesComponent'
|
import { ArticlesComponent } from './components/routes/ArticlesComponent'
|
||||||
import { ArticleDetailComponent } from './components/routes/ArticleDetailComponent'
|
import { ArticleDetailComponent } from './components/routes/ArticleDetailComponent'
|
||||||
|
|||||||
@ -1 +1 @@
|
|||||||
export * from './auth';
|
export type { User, UserRole, LoginDto, RegisterDto, AuthResponse, ApiError } from './auth';
|
||||||
30
test-article.html
Normal file
30
test-article.html
Normal 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>
|
||||||
Loading…
Reference in New Issue
Block a user