diff --git a/packages/client/src/comments/CommentActions.ts b/packages/client/src/comments/CommentActions.ts index 5cf62f5..c8e5314 100644 --- a/packages/client/src/comments/CommentActions.ts +++ b/packages/client/src/comments/CommentActions.ts @@ -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) {} + constructor(protected readonly http: IHTTPClient) {} 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, diff --git a/packages/client/src/comments/Comments.tsx b/packages/client/src/comments/Comments.tsx index 1629dad..c73e82e 100644 --- a/packages/client/src/comments/Comments.tsx +++ b/packages/client/src/comments/Comments.tsx @@ -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 { const {comment} = this.props return (
- {comment.score} + {comment.votes}

{comment.message}

- + // TODO add comment children here
) } diff --git a/packages/client/src/index.ts b/packages/client/src/index.ts index 28fbaa1..95876e1 100644 --- a/packages/client/src/index.ts +++ b/packages/client/src/index.ts @@ -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'