Skip to content
Snippets Groups Projects
Commit ff5ac252 authored by narindra.rajohnso's avatar narindra.rajohnso
Browse files

correct api requests

parent e7a5ada5
Branches
No related tags found
No related merge requests found
......@@ -11,10 +11,7 @@ interface UserData {
firstname: string;
lastname: string;
email: string;
password: string;
type: string;
createdAt: string;
updatedAt: string;
}
interface QuestionData {
......@@ -24,8 +21,6 @@ interface QuestionData {
correctResponse: number;
category: string;
type: string;
createdAt: string;
updatedAt: string;
}
@Injectable({
......@@ -86,7 +81,7 @@ export class ManageService {
user.lastname,
user.email,
user.type,
user.password
"CONFIDENTIAL!!!"
)
)
})
......@@ -171,6 +166,7 @@ export class ManageService {
take(1),
tap((users) => {
this.changeTypeKey(userInfo);
userInfo.password="CONFIDENTIAL!!!";
this._users.next(users.concat(userInfo));
})
);
......@@ -293,11 +289,9 @@ export class ManageService {
}
deleteUser(username: string) {
const body = { username: username };
return this.httpClient
.request('delete',
`http://localhost:30992/api/v1/admins/${this.username}/users/${username}`,
{body: body}
`http://localhost:30992/api/v1/admins/${this.username}/users/${username}`
)
.pipe(switchMap(() => {
return this.users;
......@@ -307,15 +301,12 @@ export class ManageService {
this._users.next(users.filter((u) => u.username !== username));
})
);
}
deleteQuestion(id: number) {
const body = { id: id };
return this.httpClient
.request('delete',
`http://localhost:30992/api/v1/admins/${this.username}/questions/${id}`,
{body: body}
`http://localhost:30992/api/v1/admins/${this.username}/questions/${id}`
)
.pipe(switchMap(() => {
return this.questions;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment