mirror of
https://github.com/ragestudio/comty.git
synced 2025-06-12 12:04:16 +00:00
use Post
model
This commit is contained in:
parent
b70f71e316
commit
3ab50d93cf
@ -1,22 +1,28 @@
|
|||||||
import React from "react"
|
import React from "react"
|
||||||
import * as antd from "antd"
|
import * as antd from "antd"
|
||||||
|
|
||||||
|
import Post from "models/post"
|
||||||
import { PostCard, CommentsCard } from "components"
|
import { PostCard, CommentsCard } from "components"
|
||||||
|
|
||||||
import "./index.less"
|
import "./index.less"
|
||||||
|
|
||||||
export default (props) => {
|
export default (props) => {
|
||||||
const [data, setData] = React.useState(null)
|
|
||||||
const post_id = props.match.params.post_id
|
const post_id = props.match.params.post_id
|
||||||
|
|
||||||
|
const [data, setData] = React.useState(null)
|
||||||
|
|
||||||
const loadData = async () => {
|
const loadData = async () => {
|
||||||
setData(null)
|
setData(null)
|
||||||
|
|
||||||
const data = await window.app.api.request("main", "get", `post`, undefined, {
|
const data = await Post.getPost({ post_id }).catch(() => {
|
||||||
post_id
|
antd.message.error("Failed to get post")
|
||||||
|
|
||||||
|
return false
|
||||||
})
|
})
|
||||||
|
|
||||||
setData(data)
|
if (data) {
|
||||||
|
setData(data)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
React.useEffect(() => {
|
React.useEffect(() => {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user