diff options
Diffstat (limited to 'src/app')
| -rw-r--r-- | src/app/components/post/post.component.css | 5 | ||||
| -rw-r--r-- | src/app/components/post/post.component.html | 2 | ||||
| -rw-r--r-- | src/app/components/post/post.component.ts | 7 | ||||
| -rw-r--r-- | src/app/services/rating.service.ts | 17 |
4 files changed, 24 insertions, 7 deletions
diff --git a/src/app/components/post/post.component.css b/src/app/components/post/post.component.css index 1b88c7d..07d931f 100644 --- a/src/app/components/post/post.component.css +++ b/src/app/components/post/post.component.css @@ -76,11 +76,6 @@ hr { /* Rating */ -/* Temporary, until ratings are implemented fully */ -.rating { - display: none !important; -} - .rating { display: flex; flex-direction: column; diff --git a/src/app/components/post/post.component.html b/src/app/components/post/post.component.html index 4ba4d43..4584591 100644 --- a/src/app/components/post/post.component.html +++ b/src/app/components/post/post.component.html @@ -30,7 +30,7 @@ </div> </section> <section class="rating"> - <button class="vote"> + <button class="vote" (click)="upVotePost()"> ᐃ </button> <summary class="score"> diff --git a/src/app/components/post/post.component.ts b/src/app/components/post/post.component.ts index 387f56f..39391ad 100644 --- a/src/app/components/post/post.component.ts +++ b/src/app/components/post/post.component.ts @@ -2,6 +2,7 @@ import { Component, Input, OnInit } from '@angular/core'; import { Router } from '@angular/router'; import { Guid } from 'guid-typescript'; import { PostService } from 'src/app/services/post.service'; +import { RatingService } from 'src/app/services/rating.service'; import { UserService } from 'src/app/services/user.service'; import { User } from 'src/models/identity/user'; import { Post } from 'src/models/post'; @@ -19,7 +20,7 @@ export class PostComponent implements OnInit { public timeCreated: string; @Input() paramId: string; - constructor(private _postService: PostService, private _userService: UserService, private _router: Router) + constructor(private _postService: PostService, private _ratingServe: RatingService, private _userService: UserService, private _router: Router) { } ngOnInit(): void { @@ -54,4 +55,8 @@ export class PostComponent implements OnInit { goToPostPage(): void { this._router.navigate(['/post/' + this.post.postId]); } + + upVotePost(): void { + + } } diff --git a/src/app/services/rating.service.ts b/src/app/services/rating.service.ts new file mode 100644 index 0000000..630a43c --- /dev/null +++ b/src/app/services/rating.service.ts @@ -0,0 +1,17 @@ +import { HttpClient, HttpHeaders, HttpParams } from '@angular/common/http'; +import { Injectable } from '@angular/core'; +import * as FormData from 'form-data'; +import { Guid } from 'guid-typescript'; +import { Observable } from 'rxjs'; +import { Post } from 'src/models/post'; +import { AppConstants } from '../app-constants.module'; +import { TokenService } from './token.service'; + + +@Injectable({ + providedIn: 'root' +}) +export class RatingService { + constructor(private _http: HttpClient, private _tokenService: TokenService) + { } +} |
