Skip to content

Commit

Permalink
Finish creating viewForum component HTML to show form responses. (#17)
Browse files Browse the repository at this point in the history
* Finish creating viewForum component HTML with Response, First and Last name, and date for each form response.

* Add in Last Name in the table to keep track of the responses, as per suggestion.

* Adjusted endpoints and remove comments.
  • Loading branch information
angelinasu57 authored Mar 30, 2023
1 parent 1d21013 commit 3f95cc9
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 20 deletions.
17 changes: 0 additions & 17 deletions frontend/src/app/makeforum/makeforum.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,21 +9,4 @@ <h1>Make a Forum Post With Resources!!</h1>
</div>
</form>

<!-- <table>
<thead>
<td>Response</td>
<td>First Name</td>
<td>Last Name</td>
<td>Date</td>
</thead>
<tbody>
<tr *ngFor="let profile of | async">
<td>{{ user.pid }}</td>
<td>{{ user.first_name}}</td>
<td>{{ user.last_name }}</td>
<button class="button" (click)="deleteFunction(user.pid)">Delete</button>
<td>{{ check.created_at | date:'YYYY/MM/dd @ hh:MMaa' }}</td>
</tr>
</tbody>
</table> -->

4 changes: 2 additions & 2 deletions frontend/src/app/post.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,12 @@ export class PostService {
// })
// )
// return new_table
return this.http.get<Post[]>("/api/forum");
return this.http.get<Post[]>("/api/posts");
}

makePost(id: number, content: string, user: Profile, votes: [], timestamp: Date): Observable<Post> {
let post: Post = {id, content, user, votes, timestamp};
return this.http.post<Post>("/api/forum/", post);
return this.http.post<Post>("/api/posts/", post);
}

// deletePost(id: number) {
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/app/viewforum/viewforum.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<tr *ngFor="let post of post$| async">
<td>{{ post.content }}</td>
<td>{{ post.user.first_name}}</td>
<td>{{ post.user.last_name }}</td>
<td>{{ post.user.last_name}}</td>
<td>{{ post.timestamp | date:'YYYY/MM/dd @ hh:MMaa' }}</td>
</tr>
</tbody>
Expand Down

0 comments on commit 3f95cc9

Please sign in to comment.