diff --git a/packages/app/src/components/UserRegister/index.jsx b/packages/app/src/components/UserRegister/index.jsx
index 45c59e7c..2da56771 100755
--- a/packages/app/src/components/UserRegister/index.jsx
+++ b/packages/app/src/components/UserRegister/index.jsx
@@ -90,7 +90,7 @@ const steps = [
return
}
- const request = await app.api.customRequest("main", {
+ const request = await app.cores.api.customRequest("main", {
method: "GET",
url: "/user/username-available",
params: {
@@ -308,7 +308,7 @@ const steps = [
const timer = setTimeout(async () => {
if (!validFormat) return
- const request = await app.api.customRequest("main", {
+ const request = await app.cores.api.customRequest("main", {
method: "GET",
url: "/user/email-available",
params: {
diff --git a/packages/app/src/components/UserSelector/index.jsx b/packages/app/src/components/UserSelector/index.jsx
index 2cca9e25..917c2f73 100755
--- a/packages/app/src/components/UserSelector/index.jsx
+++ b/packages/app/src/components/UserSelector/index.jsx
@@ -14,7 +14,7 @@ export default class UserSelector extends React.Component {
searchValue: null,
}
- api = window.app.api.withEndpoints("main")
+ api = window.app.cores.api.withEndpoints("main")
componentDidMount = async () => {
this.toogleLoading(true)
diff --git a/packages/app/src/pages/home/components/explore/index.jsx b/packages/app/src/pages/home/components/explore/index.jsx
deleted file mode 100755
index b4c0ecb7..00000000
--- a/packages/app/src/pages/home/components/explore/index.jsx
+++ /dev/null
@@ -1,126 +0,0 @@
-import React from "react"
-import { Skeleton } from "antd"
-import { Icons } from "components/Icons"
-
-import { PostsList, Searcher } from "components"
-import Post from "models/post"
-
-import "./index.less"
-
-export default class ExplorePosts extends React.Component {
- state = {
- loading: true,
- initialLoading: true,
- hasMorePosts: true,
- posts: [],
- focusedSearcher: false,
- filledSearcher: false,
- }
-
- wsEvents = {
- "post.new": async (data) => {
- this.setState({
- posts: [data, ...this.state.posts],
- })
- },
- "post.delete": async (id) => {
- this.setState({
- posts: this.state.posts.filter((post) => {
- return post._id !== id
- }),
- })
- }
- }
-
- loadPosts = async ({
- trim,
- replace = false
- } = {}) => {
- await this.setState({
- loading: true,
- })
-
- // get posts from api
- const result = await Post.getExplorePosts({
- trim: trim ?? this.state.posts.length,
- })
-
- console.log("Loaded posts => \n", result)
-
- if (result) {
- if (result.length === 0) {
- await this.setState({
- hasMorePosts: 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,
- })
- }
- }
-
- toggleFocusSearcher = (to) => {
- to = to ?? !this.state.focusedSearcher
-
- this.setState({
- focusedSearcher: to
- })
- }
-
- toggleState = (key, to) => {
- to = to ?? !this.state[key]
-
- this.setState({
- [key]: to
- })
- }
-
- componentDidMount = async () => {
- await this.loadPosts()
-
- Object.keys(this.wsEvents).forEach((event) => {
- window.app.api.namespaces["main"].listenEvent(event, this.wsEvents[event])
- })
- }
-
- componentWillUnmount = async () => {
- Object.keys(this.wsEvents).forEach((event) => {
- window.app.api.namespaces["main"].unlistenEvent(event, this.wsEvents[event])
- })
- }
-
- render() {
- return
-
- this.toggleState("focusedSearcher", true)}
- onUnfocus={() => this.toggleState("focusedSearcher", false)}
- onFilled={() => this.toggleState("filledSearcher", true)}
- onEmpty={() => this.toggleState("filledSearcher", false)}
- />
-
- {
- this.state.focusedSearcher || this.state.filledSearcher ? null : this.state.initialLoading ?
:
- }
-
- }
-}
\ No newline at end of file
diff --git a/packages/app/src/pages/home/components/explore/index.less b/packages/app/src/pages/home/components/explore/index.less
deleted file mode 100755
index 07d5974d..00000000
--- a/packages/app/src/pages/home/components/explore/index.less
+++ /dev/null
@@ -1,8 +0,0 @@
-.postsExplore {
- width: 100%;
-
- .postsExplore_header {
- font-size: 1.3rem;
- margin-bottom: 20px;
- }
-}
\ No newline at end of file
diff --git a/packages/app/src/pages/home/components/feed/index.jsx b/packages/app/src/pages/home/components/feed/index.jsx
deleted file mode 100755
index 747dbdd3..00000000
--- a/packages/app/src/pages/home/components/feed/index.jsx
+++ /dev/null
@@ -1,118 +0,0 @@
-import React from "react"
-import { Skeleton } from "antd"
-
-import { PostsList, PostCreator } from "components"
-
-import FeedModel from "models/feed"
-
-import "./index.less"
-
-const emptyListRender = () => {
- return
-}
-
-export default class Feed extends React.Component {
- state = {
- loading: true,
- initialLoading: true,
- hasMorePosts: true,
- posts: [],
- }
-
- wsEvents = {
- "post.new": async (data) => {
- this.setState({
- posts: [data, ...this.state.posts],
- })
- },
- "post.delete": async (id) => {
- this.setState({
- posts: this.state.posts.filter((post) => {
- return post._id !== id
- }),
- })
- }
- }
-
- loadData = async ({
- trim,
- replace = false
- } = {}) => {
- await this.setState({
- loading: true,
- })
-
- // get posts from api
- const result = await FeedModel.getPostsFeed({
- 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 = async () => {
- await this.loadData()
-
- Object.keys(this.wsEvents).forEach((event) => {
- window.app.api.namespaces["main"].listenEvent(event, this.wsEvents[event])
- })
- }
-
- componentWillUnmount = async () => {
- Object.keys(this.wsEvents).forEach((event) => {
- window.app.api.namespaces["main"].unlistenEvent(event, this.wsEvents[event])
- })
- }
-
- render() {
- return
-
-
- {
- this.state.initialLoading ?
:
- }
-
- }
-}
\ No newline at end of file
diff --git a/packages/app/src/pages/home/components/feed/index.less b/packages/app/src/pages/home/components/feed/index.less
deleted file mode 100755
index b6e805e5..00000000
--- a/packages/app/src/pages/home/components/feed/index.less
+++ /dev/null
@@ -1,33 +0,0 @@
-.feed {
- display: flex;
- flex-direction: column;
-
- align-items: center;
- justify-content: center;
-
- width: 100%;
-
- .feed_header {
- display: flex;
- flex-direction: column;
-
- align-items: center;
- justify-content: center;
-
- width: 100%;
-
- margin-bottom: 20px;
- }
-
- .emptyFeed {
- display: flex;
- flex-direction: column;
-
- align-items: center;
- justify-content: center;
-
- width: 100%;
-
- margin-top: 20px;
- }
-}
\ No newline at end of file
diff --git a/packages/app/src/pages/home/components/savedPosts/index.jsx b/packages/app/src/pages/home/components/savedPosts/index.jsx
deleted file mode 100755
index 291075cf..00000000
--- a/packages/app/src/pages/home/components/savedPosts/index.jsx
+++ /dev/null
@@ -1,91 +0,0 @@
-import React from "react"
-import { Skeleton } from "antd"
-import { Icons } from "components/Icons"
-
-import { PostsList } from "components"
-import Post from "models/post"
-
-import "./index.less"
-
-const emptyListRender = () => {
- return
-
- You dont have any saved posts.
-
-
-}
-
-export default class SavedPosts extends React.Component {
- state = {
- loading: true,
- initialLoading: true,
- hasMorePosts: true,
- posts: [],
- }
-
- loadData = async ({
- trim,
- replace = false
- } = {}) => {
- await this.setState({
- loading: true,
- })
-
- const result = await Post.getSavedPosts({
- 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
-
-
-
- Saved Posts
-
-
-
- {
- this.state.initialLoading ?
:
- }
-
- }
-}
\ No newline at end of file
diff --git a/packages/app/src/pages/home/components/savedPosts/index.less b/packages/app/src/pages/home/components/savedPosts/index.less
deleted file mode 100755
index 0c36f204..00000000
--- a/packages/app/src/pages/home/components/savedPosts/index.less
+++ /dev/null
@@ -1,7 +0,0 @@
-.savedPosts {
- width: 100%;
-
- .savedPosts_header {
- font-size: 1.3rem;
- }
-}
\ No newline at end of file
diff --git a/packages/app/src/pages/home/components/trendings/index.jsx b/packages/app/src/pages/home/components/trendings/index.jsx
deleted file mode 100755
index ddc03329..00000000
--- a/packages/app/src/pages/home/components/trendings/index.jsx
+++ /dev/null
@@ -1,14 +0,0 @@
-import React from "react"
-import { Result } from "antd"
-
-import "./index.less"
-
-export default (props) => {
- return
-
-
-}
\ No newline at end of file
diff --git a/packages/app/src/pages/home/components/trendings/index.less b/packages/app/src/pages/home/components/trendings/index.less
deleted file mode 100755
index db49f864..00000000
--- a/packages/app/src/pages/home/components/trendings/index.less
+++ /dev/null
@@ -1 +0,0 @@
-.trendingsBrowser {}
\ No newline at end of file
diff --git a/packages/app/src/pages/home/tabs.jsx b/packages/app/src/pages/home/tabs.jsx
deleted file mode 100755
index 16b19096..00000000
--- a/packages/app/src/pages/home/tabs.jsx
+++ /dev/null
@@ -1,27 +0,0 @@
-import FeedTab from "./components/feed"
-import ExploreTab from "./components/explore"
-import TrendingsTab from "./components/trendings"
-import SavedPostsTab from "./components/savedPosts"
-
-export default {
- "feed": {
- title: "Feed",
- icon: "Rss",
- component: FeedTab
- },
- "explore": {
- title: "Explore",
- icon: "Search",
- component: ExploreTab
- },
- "trendings": {
- title: "Trendings",
- icon: "TrendingUp",
- component: TrendingsTab
- },
- "savedPosts": {
- title: "Saved posts",
- icon: "Bookmark",
- component: SavedPostsTab
- }
-}
\ No newline at end of file