diff --git a/packages/app/src/pages/account/tabs/posts.jsx b/packages/app/src/pages/account/tabs/posts.jsx index d4530f58..b59d9f78 100755 --- a/packages/app/src/pages/account/tabs/posts.jsx +++ b/packages/app/src/pages/account/tabs/posts.jsx @@ -1,7 +1,7 @@ import React from "react" -import { Skeleton, Result } from "antd" +import { Result } from "antd" -import Post from "models/post" +import PostModel from "models/post" import { PostsList } from "components" import { Icons } from "components/Icons" @@ -17,73 +17,16 @@ const emptyListRender = () => { } export default class UserPosts extends React.Component { - state = { - loading: true, - initialLoading: true, - hasMorePosts: true, - posts: [], - } - - contentsRef = React.createRef() - - loadData = async ({ - trim, - replace = false - } = {}) => { - await this.setState({ - loading: true, - }) - - const result = await Post.getUserPosts({ - user_id: this.props.state.user._id, - trim: trim ?? this.state.posts.length, - }) - - console.log("Loaded data => \n", result) - - if (result) { - if (result.length === 0) { - await this.setState({ - hasMorePosts: false, - loading: false, - initialLoading: false, - }) - - return false - } - - await this.setState({ - posts: replace ? result : [...this.state.posts, ...result], - }) - } - - await this.setState({ - loading: false, - }) - - if (this.state.initialLoading) { - await this.setState({ - initialLoading: false, - }) - } - } - - componentDidMount() { - this.loadData() - } - render() { return