aboutsummaryrefslogtreecommitdiff
path: root/src/app
diff options
context:
space:
mode:
authorSyndamia <kamen.d.mladenov@protonmail.com>2021-02-25 14:38:12 +0200
committerSyndamia <kamen.d.mladenov@protonmail.com>2021-02-25 14:38:12 +0200
commiteab7b2108d91af1c905f795febf811d5cc404863 (patch)
tree968c641667d60532c0dbc97bd13d3284f3bbcdc6 /src/app
parenta7bf5cad6bf66f2cd7e12fc436410fafb7826b10 (diff)
downloadDevHive-Angular-eab7b2108d91af1c905f795febf811d5cc404863.tar
DevHive-Angular-eab7b2108d91af1c905f795febf811d5cc404863.tar.gz
DevHive-Angular-eab7b2108d91af1c905f795febf811d5cc404863.zip
Removed unnecessary variables from request subscriptions
Diffstat (limited to 'src/app')
-rw-r--r--src/app/components/admin-panel-page/admin-panel-page.component.ts20
-rw-r--r--src/app/components/comment-page/comment-page.component.ts7
-rw-r--r--src/app/components/feed/feed.component.ts9
-rw-r--r--src/app/components/post-page/post-page.component.ts9
-rw-r--r--src/app/components/profile-settings/profile-settings.component.ts10
-rw-r--r--src/app/components/profile/profile.component.ts15
6 files changed, 31 insertions, 39 deletions
diff --git a/src/app/components/admin-panel-page/admin-panel-page.component.ts b/src/app/components/admin-panel-page/admin-panel-page.component.ts
index 99c0721..95d69d3 100644
--- a/src/app/components/admin-panel-page/admin-panel-page.component.ts
+++ b/src/app/components/admin-panel-page/admin-panel-page.component.ts
@@ -53,7 +53,7 @@ export class AdminPanelPageComponent implements OnInit {
this._router.navigate(['/login']);
}
},
- (err: HttpErrorResponse) => {
+ () => {
this._router.navigate(['/login']);
}
);
@@ -129,7 +129,7 @@ export class AdminPanelPageComponent implements OnInit {
if (languageCreate !== '' && languageCreate !== null) {
this._languageService.createLanguageWithSessionStorageRequest(languageCreate.trim()).subscribe(
- (result: object) => {
+ () => {
this.languageModifiedSuccess('Successfully updated languages!');
},
(err: HttpErrorResponse) => {
@@ -147,7 +147,7 @@ export class AdminPanelPageComponent implements OnInit {
const langId = this.availableLanguages.filter(x => x.name === updateLanguageOldName.trim())[0].id;
this._languageService.putLanguageWithSessionStorageRequest(langId, updateLanguageNewName.trim()).subscribe(
- (result: object) => {
+ () => {
this.languageModifiedSuccess('Successfully updated languages!');
},
(err: HttpErrorResponse) => {
@@ -164,7 +164,7 @@ export class AdminPanelPageComponent implements OnInit {
const langId = this.availableLanguages.filter(x => x.name === deleteLanguageName.trim())[0].id;
this._languageService.deleteLanguageWithSessionStorageRequest(langId).subscribe(
- (result: object) => {
+ () => {
this.languageModifiedSuccess('Successfully deleted language!');
},
(err: HttpErrorResponse) => {
@@ -205,7 +205,7 @@ export class AdminPanelPageComponent implements OnInit {
if (technologyCreate !== '' && technologyCreate !== null) {
this._technologyService.createTechnologyWithSessionStorageRequest(technologyCreate.trim()).subscribe(
- (result: object) => {
+ () => {
this.technologyModifiedSuccess('Successfully updated technologies!');
},
(err: HttpErrorResponse) => {
@@ -223,7 +223,7 @@ export class AdminPanelPageComponent implements OnInit {
const techId = this.availableTechnologies.filter(x => x.name === updateTechnologyOldName.trim())[0].id;
this._technologyService.putTechnologyWithSessionStorageRequest(techId, updateTechnologyNewName.trim()).subscribe(
- (result: object) => {
+ () => {
this.technologyModifiedSuccess('Successfully updated technologies!');
},
(err: HttpErrorResponse) => {
@@ -240,7 +240,7 @@ export class AdminPanelPageComponent implements OnInit {
const techId = this.availableTechnologies.filter(x => x.name === deleteTechnologyName.trim())[0].id;
this._technologyService.deleteTechnologyWithSessionStorageRequest(techId).subscribe(
- (result: object) => {
+ () => {
this.technologyModifiedSuccess('Successfully deleted technology!');
},
(err: HttpErrorResponse) => {
@@ -283,7 +283,7 @@ export class AdminPanelPageComponent implements OnInit {
const userId: Guid = Guid.parse(deleteUser);
this._userService.deleteUserRequest(userId, this._tokenService.getTokenFromSessionStorage()).subscribe(
- (result: object) => {
+ () => {
this.deletionSuccess('Successfully deleted user!');
},
(err: HttpErrorResponse) => {
@@ -300,7 +300,7 @@ export class AdminPanelPageComponent implements OnInit {
const postId: Guid = Guid.parse(deletePost);
this._postService.deletePostRequest(postId, this._tokenService.getTokenFromSessionStorage()).subscribe(
- (result: object) => {
+ () => {
this.deletionSuccess('Successfully deleted user!');
},
(err: HttpErrorResponse) => {
@@ -317,7 +317,7 @@ export class AdminPanelPageComponent implements OnInit {
const commentId: Guid = Guid.parse(deleteComment);
this._commentService.deleteCommentWithSessionStorage(commentId).subscribe(
- (result: object) => {
+ () => {
this.deletionSuccess('Successfully deleted comment!');
},
(err: HttpErrorResponse) => {
diff --git a/src/app/components/comment-page/comment-page.component.ts b/src/app/components/comment-page/comment-page.component.ts
index 045e8ea..413436e 100644
--- a/src/app/components/comment-page/comment-page.component.ts
+++ b/src/app/components/comment-page/comment-page.component.ts
@@ -1,4 +1,3 @@
-import { HttpErrorResponse } from '@angular/common/http';
import { Component, OnInit } from '@angular/core';
import { FormBuilder, FormControl, FormGroup } from '@angular/forms';
import { Title } from '@angular/platform-browser';
@@ -42,7 +41,7 @@ export class CommentPageComponent implements OnInit {
}
this.loaded = true;
},
- (err: HttpErrorResponse) => {
+ () => {
this._router.navigate(['/not-found']);
}
);
@@ -68,7 +67,7 @@ export class CommentPageComponent implements OnInit {
if (newMessage !== '' && newMessage !== this.comment.message) {
console.log(this.commentId);
this._commentService.putCommentWithSessionStorageRequest(this.commentId, this.comment.postId, newMessage).subscribe(
- (result: object) => {
+ () => {
this.reloadPage();
}
);
@@ -79,7 +78,7 @@ export class CommentPageComponent implements OnInit {
deleteComment(): void {
this._commentService.deleteCommentWithSessionStorage(this.commentId).subscribe(
- (result: object) => {
+ () => {
this.toPost();
}
);
diff --git a/src/app/components/feed/feed.component.ts b/src/app/components/feed/feed.component.ts
index b412b3c..eaa0ef1 100644
--- a/src/app/components/feed/feed.component.ts
+++ b/src/app/components/feed/feed.component.ts
@@ -4,7 +4,6 @@ import { Router } from '@angular/router';
import { User } from 'src/models/identity/user';
import { UserService } from '../../services/user.service';
import { AppConstants } from 'src/app/app-constants.module';
-import { HttpErrorResponse } from '@angular/common/http';
import { FeedService } from 'src/app/services/feed.service';
import { Post } from 'src/models/post';
import { FormBuilder, FormControl, FormGroup } from '@angular/forms';
@@ -55,7 +54,7 @@ export class FeedComponent implements OnInit {
Object.assign(this.user, res);
this.loadFeed();
},
- (err: HttpErrorResponse) => {
+ () => {
this.logout();
}
);
@@ -67,7 +66,7 @@ export class FeedComponent implements OnInit {
this.posts.push(...Object.values(result)[0]);
this.finishUserLoading();
},
- (err) => {
+ () => {
this.finishUserLoading();
}
);
@@ -104,10 +103,10 @@ export class FeedComponent implements OnInit {
this.dataArrived = false;
this._postService.createPostWithSessionStorageRequest(postMessage, this.files).subscribe(
- (result: object) => {
+ () => {
this.goToProfile();
},
- (err: HttpErrorResponse) => {
+ () => {
this.dataArrived = true;
}
);
diff --git a/src/app/components/post-page/post-page.component.ts b/src/app/components/post-page/post-page.component.ts
index 3218a19..1ac89f4 100644
--- a/src/app/components/post-page/post-page.component.ts
+++ b/src/app/components/post-page/post-page.component.ts
@@ -1,4 +1,3 @@
-import { HttpErrorResponse } from '@angular/common/http';
import { Component, OnInit } from '@angular/core';
import { FormBuilder, FormControl, FormGroup } from '@angular/forms';
import { Title } from '@angular/platform-browser';
@@ -53,7 +52,7 @@ export class PostPageComponent implements OnInit {
this.dataArrived = true;
}
},
- (err: HttpErrorResponse) => {
+ () => {
this._router.navigate(['/not-found']);
}
);
@@ -120,7 +119,7 @@ export class PostPageComponent implements OnInit {
if (newMessage === '' && newMessage !== this.post.message) {
this._postService.putPostWithSessionStorageRequest(this.postId, newMessage, this.files).subscribe(
- (result: object) => {
+ () => {
this.reloadPage();
}
);
@@ -139,7 +138,7 @@ export class PostPageComponent implements OnInit {
const newComment = this.addCommentFormGroup.get('newComment')?.value;
if (newComment !== '' && newComment !== null) {
this._commentService.createCommentWithSessionStorageRequest(this.postId, newComment).subscribe(
- (result: object) => {
+ () => {
this.editPostFormGroup.reset();
this.reloadPage();
}
@@ -149,7 +148,7 @@ export class PostPageComponent implements OnInit {
deletePost(): void {
this._postService.deletePostWithSessionStorage(this.postId).subscribe(
- (result: object) => {
+ () => {
this._router.navigate(['/profile/' + this._tokenService.getUsernameFromSessionStorageToken()]);
}
);
diff --git a/src/app/components/profile-settings/profile-settings.component.ts b/src/app/components/profile-settings/profile-settings.component.ts
index a484665..f3cd4c1 100644
--- a/src/app/components/profile-settings/profile-settings.component.ts
+++ b/src/app/components/profile-settings/profile-settings.component.ts
@@ -56,7 +56,7 @@ export class ProfileSettingsComponent implements OnInit {
this.isAdminUser = this.user.roles.map(x => x.name).includes(AppConstants.ADMIN_ROLE_NAME);
this.finishUserLoading();
},
- (err: HttpErrorResponse) => {
+ () => {
this._router.navigate(['/not-found']);
}
);
@@ -89,7 +89,7 @@ export class ProfileSettingsComponent implements OnInit {
this.goToProfile();
}
},
- (err: HttpErrorResponse) => {
+ () => {
this.logout();
}
);
@@ -181,7 +181,7 @@ export class ProfileSettingsComponent implements OnInit {
}
this._userService.putProfilePictureFromSessionStorageRequest(this.newProfilePicture).subscribe(
- (result: object) => {
+ () => {
this.reloadPage();
}
);
@@ -196,7 +196,7 @@ export class ProfileSettingsComponent implements OnInit {
this.patchTechnologiesControl();
this._userService.putUserFromSessionStorageRequest(this.updateUserFormGroup, this.user.roles, this.user.friends).subscribe(
- (result: object) => {
+ () => {
this._successBar.showMsg('Profile updated successfully!');
},
(err: HttpErrorResponse) => {
@@ -285,7 +285,7 @@ export class ProfileSettingsComponent implements OnInit {
deleteAccount(): void {
if (this.deleteAccountConfirm) {
this._userService.deleteUserFromSessionStorageRequest().subscribe(
- (res: object) => {
+ () => {
this.logout();
},
(err: HttpErrorResponse) => {
diff --git a/src/app/components/profile/profile.component.ts b/src/app/components/profile/profile.component.ts
index bbf8585..eaa1bec 100644
--- a/src/app/components/profile/profile.component.ts
+++ b/src/app/components/profile/profile.component.ts
@@ -3,7 +3,6 @@ import { Router } from '@angular/router';
import { UserService } from 'src/app/services/user.service';
import { User } from 'src/models/identity/user';
import { AppConstants } from 'src/app/app-constants.module';
-import { HttpErrorResponse } from '@angular/common/http';
import { Location } from '@angular/common';
import { LanguageService } from 'src/app/services/language.service';
import { TechnologyService } from 'src/app/services/technology.service';
@@ -38,10 +37,6 @@ export class ProfileComponent implements OnInit {
this._titleService.setTitle(this._title);
}
- private setDefaultUser(): void {
- this.user = this._userService.getDefaultUser();
- }
-
ngOnInit(): void {
this._urlUsername = this._router.url.substring(9);
@@ -63,7 +58,7 @@ export class ProfileComponent implements OnInit {
this.isAdminUser = this.user.roles.map(x => x.name).includes(AppConstants.ADMIN_ROLE_NAME);
this.loadLanguages();
},
- (err: HttpErrorResponse) => {
+ () => {
this._router.navigate(['/not-found']);
}
);
@@ -102,7 +97,7 @@ export class ProfileComponent implements OnInit {
this.userPosts.push(...resultArr);
this.finishUserLoading();
},
- (err: HttpErrorResponse) => {
+ () => {
this._currentPage = -1;
this.finishUserLoading();
}
@@ -126,7 +121,7 @@ export class ProfileComponent implements OnInit {
}
this.dataArrived = true;
},
- (err: HttpErrorResponse) => {
+ () => {
this.logout();
}
);
@@ -175,10 +170,10 @@ export class ProfileComponent implements OnInit {
}
this._userService.putBareUserFromSessionStorageRequest(loggedInUser, this.updateFrienship.get('password')?.value).subscribe(
- (resultUpdate: object) => {
+ () => {
this.reloadPage();
},
- (err: HttpErrorResponse) => {
+ () => {
this._router.navigate(['/']);
}
);