diff --git a/src/types/index.ts b/src/types/index.ts new file mode 100644 index 0000000..e125643 --- /dev/null +++ b/src/types/index.ts @@ -0,0 +1,40 @@ +export type PostStatus = "draft" | "published"; + +export interface Post { + id: string; + title: string; + slug: string; + content: string; + excerpt?: string; + status: PostStatus; + tags: string[]; + coverImage?: string; + views?: number; + createdAt: string; + updatedAt: string; +} + +export interface User { + id: string; + name: string; + email: string; + password?: string; + avatar?: string; +} + +export interface AuthState { + user: User | null; + isAuthenticated: boolean; + login: (email: string, password: string) => boolean; + logout: () => void; + checkAuth: () => void; + updateUser: (data: Partial) => void; +} + +export interface ContentState { + posts: Post[]; + addPost: (post: Omit) => Post; + updatePost: (id: string, data: Partial) => void; + deletePost: (id: string) => void; + getPostById: (id: string) => Post | undefined; +}