Fix compile error in packages/client

This commit is contained in:
Jerko Steiner 2019-03-13 13:48:17 +05:00
parent 61edf10a5b
commit 93584575d9
3 changed files with 13 additions and 12 deletions

View File

@ -1,5 +1,5 @@
import {IHTTPClient} from '../http'
import {IComment, IAPIDef} from '@rondo/common'
import {IComment, ICommentsAPIDef} from '@rondo/comments-common'
export enum ICommentActionTypes {
VOTE_UP = 'VOTE_UP',
@ -14,7 +14,7 @@ export enum ICommentActionTypes {
}
export class CommentActions {
constructor(protected readonly http: IHTTPClient<IAPIDef>) {}
constructor(protected readonly http: IHTTPClient<ICommentsAPIDef>) {}
voteUp(comment: IComment) {
return {
@ -36,7 +36,7 @@ export class CommentActions {
getComments(storyId: number) {
return {
payload: this.http.get('/story/:storyId/comments', null, {
payload: this.http.get('/stories/:storyId/comments', null, {
storyId,
}),
type: ICommentActionTypes.COMMENTS_RETRIEVE,
@ -47,7 +47,7 @@ export class CommentActions {
if (!comment.parentId) {
// root comment
return {
payload: this.http.post('/story/:storyId/comments', comment, {
payload: this.http.post('/stories/:storyId/comments', comment, {
storyId: comment.storyId,
}),
type: ICommentActionTypes.COMMENT_ADD,
@ -56,7 +56,9 @@ export class CommentActions {
// nested comment
return {
payload: this.http.post('/comments/:parentId', comment, {
payload: this.http
.post('/stories/:storyId/comments/:parentId', comment, {
storyId: comment.storyId,
parentId: comment.parentId,
}),
type: ICommentActionTypes.COMMENT_ADD,

View File

@ -1,5 +1,5 @@
import React from 'react'
import {IComment} from '@rondo/common'
import {IComment} from '@rondo/comments-common'
export interface ICommentProps {
comment: IComment
@ -7,14 +7,13 @@ export interface ICommentProps {
export class CommentVote extends React.PureComponent {
render() {
return (
)
return 'vote'
}
}
export class CommentButtons extends React.PureComponent {
render() {
return 'buttons'
}
}
@ -23,10 +22,10 @@ export class Comment extends React.PureComponent<ICommentProps> {
const {comment} = this.props
return (
<div className='comment'>
<span className='score'>{comment.score}</span>
<span className='score'>{comment.votes}</span>
<p>{comment.message}</p>
<Comments comments={comment.children} />
// TODO add comment children here
</div>
)
}

View File

@ -2,5 +2,5 @@ export * from './actions'
export * from './components'
export * from './http'
export * from './middleware'
export * from './reducers'
export * from './redux'
export * from './renderer'