1
1
"use client"
2
+ << < < << < HEAD
2
3
import svPost from "../../../utils/svPost"
4
+ === = ===
5
+ import svPost from "@/services/svPost" ;
6
+ import svCmt from "@/services/svCmt" ;
7
+ > >>> >>> 5 a06110 ( chore ( fe ) : split service )
3
8
import Link from "next/link" ;
4
9
import Comment from "@/components/Comment" ;
5
10
import Parser from 'html-react-parser'
@@ -9,12 +14,19 @@ import CmtForm from "@/components/CmtForm";
9
14
import { getRelativeTime } from "@/utils/getRelativeTime" ;
10
15
import axios from "axios" ;
11
16
import { GoTrash } from "react-icons/go" ;
17
+ < < << << < HEAD
12
18
import { useEffect } from "react" ;
19
+ = === ===
20
+ import { IPost , IComment } from "@/types" ;
21
+ import LikeButton from "@/components/LikeButton" ;
22
+ import svLike from "@/services/svLike" ;
23
+ > >>> >>> 5 a06110 ( chore ( fe ) : split service )
13
24
type Props = {
14
25
params : { id : string } ;
15
26
} ;
16
27
export default async function Post ( { params } : Props ) {
17
28
const id : string = params . id ;
29
+ < < << << < HEAD
18
30
const { getPost , getLike , getComment , delPost } = await svPost ( ) ;
19
31
useEffect ( aysnc ( ) = > {
20
32
const info : any = await getPost ( id ) ;
@@ -48,6 +60,18 @@ export default async function Post({ params }: Props) {
48
60
} ;
49
61
const handleDelPost = async ( e : React . FormEvent ) => {
50
62
let token : any
63
+ = = === ==
64
+ const { getPost, delPost } = svPost ( ) ;
65
+ const { getLike} = svLike ( ) ;
66
+ const { getComment} = svCmt ( )
67
+ const info : IPost = await getPost ( id ) ;
68
+ const likes : number = await getLike ( id ) ;
69
+ console . log ( likes )
70
+ const comment : IComment [ ] = await getComment ( id ) ;
71
+ const author_url = "/user/" + info . author . id ;
72
+ const handleDelPost = async ( ) => {
73
+ let token : string | null = null
74
+ >>> > >>> 5 a06110 ( chore ( fe ) : split service )
51
75
if ( typeof window !== 'undefined' )
52
76
token = localStorage . getItem ( 'jwt' )
53
77
const deletePost :any = await delPost ( id , token ) ;
0 commit comments