refactor: remove authentication check and unused imports from CreatePost and EditPost pages
All checks were successful
CI - Build and Push / Build and Push Docker Image (push) Successful in 17s
All checks were successful
CI - Build and Push / Build and Push Docker Image (push) Successful in 17s
This commit is contained in:
@@ -1,18 +1,16 @@
|
||||
import { useState, useRef } from 'react';
|
||||
import { Navigate, useNavigate } from 'react-router-dom';
|
||||
import { useNavigate } from 'react-router-dom';
|
||||
import Layout from '../components/Layout';
|
||||
import BlogEditor, { type BlogEditorRef } from '../blog/BlogEditor';
|
||||
import { uploadImage, createBlogPost } from '../blog/api';
|
||||
import { Toast } from '../components/Toast';
|
||||
import { useToast } from '../hooks/useToast';
|
||||
import { useAuth } from '../contexts/AuthContext';
|
||||
import '../App.css';
|
||||
|
||||
function CreatePost() {
|
||||
const navigate = useNavigate();
|
||||
const editorRef = useRef<BlogEditorRef>(null);
|
||||
const { toasts, removeToast, success, error } = useToast();
|
||||
const { isAuthenticated } = useAuth();
|
||||
const [title, setTitle] = useState('');
|
||||
const [coverImage, setCoverImage] = useState<string | null>(null);
|
||||
const [coverImageKey, setCoverImageKey] = useState<string>('');
|
||||
@@ -101,10 +99,6 @@ function CreatePost() {
|
||||
}
|
||||
};
|
||||
|
||||
if (!isAuthenticated) {
|
||||
return <Navigate to="/blog" replace />;
|
||||
}
|
||||
|
||||
return (
|
||||
<Layout currentPage="blog">
|
||||
<Toast toasts={toasts} onRemove={removeToast} />
|
||||
|
||||
Reference in New Issue
Block a user