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

View File

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

View File

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