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

correct route to the api

parent 20025e53
No related branches found
No related tags found
No related merge requests found
File moved
......@@ -48,7 +48,7 @@ export class QuizzService {
async getUserInfo(): Promise<Session> {
return new Promise<any>((resolve, reject) => {
this.httpClient.get<any>('http://localhost:30992/api/v1/gamer/' + this.username).subscribe(
this.httpClient.get<any>('http://localhost:30992/api/v1/users/' + this.username).subscribe(
response => {
this._userInfo = new Session(
response.access_user.username,
......
......@@ -40,7 +40,7 @@ export class SignInComponent implements OnInit{
password: this.loginService.hashPassword(this.formData.value.password)
}
let username:string=this.formData.value.username;
this.httpClient.post<any>('http://localhost:30992/api/v1/guest/'+username, passwordPost).subscribe(
this.httpClient.post<any>('http://localhost:30992/api/v1/guests/users/'+username, passwordPost).subscribe(
response => {
console.log("reponse sign in:", response);
this.sessionService.session=new Session(username, response.firstname, response.lastname);
......
......@@ -33,7 +33,7 @@ export class SignUpComponent{
}
this.formData.value.password = this.loginService.hashPassword(this.formData.value.password);
this.formData.value.accountType=0;
this.httpClient.post<any>('http://localhost:30992/api/v1/guest/create-account', this.formData.value).subscribe(
this.httpClient.post<any>('http://localhost:30992/api/v1/guests/users', this.formData.value).subscribe(
response => {
console.log(response);
this.router.navigate(['/login/sign-in']);
......
......@@ -58,10 +58,7 @@ export class ManageService {
async getUserInfo(): Promise<any> {
return new Promise<any>((resolve, reject) => {
let usernamePost = {
username: this.username
};
this.httpClient.post<any>('http://localhost:30992/api/v1/admin/' + this.username + '/get-user', usernamePost).subscribe(
this.httpClient.get<any>('http://localhost:30992/api/v1/admins/' + this.username).subscribe(
response => {
resolve(response.info_user);
},
......@@ -75,7 +72,7 @@ export class ManageService {
fetchUsers() {
return this.httpClient
.get<{ users: UserData[] }>(
'http://localhost:30992/api/v1/admin/' + this.username + '/list-users'
'http://localhost:30992/api/v1/admins/' + this.username + '/users'
)
.pipe(
map((resDonnee) => {
......@@ -105,7 +102,7 @@ export class ManageService {
fetchQuestions() {
return this.httpClient
.get<{ questions: QuestionData[] }>(
'http://localhost:30992/api/v1/admin/' + this.username + '/list-questions'
'http://localhost:30992/api/v1/admins/' + this.username + '/questions'
)
.pipe(
map((resDonnee) => {
......@@ -166,7 +163,7 @@ export class ManageService {
else
userInfo.accountType = 1;
userInfo.password=this.loginService.hashPassword(userInfo.password);
return this.httpClient.post<any>('http://localhost:30992/api/v1/admin/'+this.username+'/create-user-account', userInfo)
return this.httpClient.post<any>('http://localhost:30992/api/v1/admins/'+this.username+'/users', userInfo)
.pipe(
switchMap(() => {
return this.users;
......@@ -200,7 +197,7 @@ export class ManageService {
parseInt(formDataQuestion.value.correctResponse),
formDataQuestion.value.category
);
return this.httpClient.post<any>('http://localhost:30992/api/v1/admin/'+this.username+'/create-question', questionInfo)
return this.httpClient.post<any>('http://localhost:30992/api/v1/admins/'+this.username+'/questions', questionInfo)
.pipe(
switchMap((resDonnee) => {
generateId = resDonnee.new_question.id;
......@@ -236,7 +233,7 @@ export class ManageService {
const pastUser = editUsers[usernameSearch];
console.log("type:", type);
editUsers[usernameSearch] = new User(
username,
new_username,
firstname,
lastname,
email,
......@@ -247,7 +244,7 @@ export class ManageService {
let userEdited=this.changeAccountTypeKey(editUsers[usernameSearch]);
console.log(userEdited);
return this.httpClient.put(
`http://localhost:30992/api/v1/admin/${this.username}/update-user-account`,
`http://localhost:30992/api/v1/admins/${this.username}/users/'${username}`,
{ ...userEdited }
);
......@@ -284,7 +281,7 @@ export class ManageService {
category
);
return this.httpClient.put(
`http://localhost:30992/api/v1/admin/${this.username}/update-question`,
`http://localhost:30992/api/v1/admins/${this.username}/questions/${id}`,
{ ...editQuestions[idQuestionSearch] }
);
......@@ -299,7 +296,7 @@ export class ManageService {
const body = { username: username };
return this.httpClient
.request('delete',
`http://localhost:30992/api/v1/admin/${this.username}/delete-user-account`,
`http://localhost:30992/api/v1/admins/${this.username}/users/${username}`,
{body: body}
)
.pipe(switchMap(() => {
......@@ -317,7 +314,7 @@ export class ManageService {
const body = { id: id };
return this.httpClient
.request('delete',
`http://localhost:30992/api/v1/admin/${this.username}/delete-question`,
`http://localhost:30992/api/v1/admins/${this.username}/questions/${id}`,
{body: body}
)
.pipe(switchMap(() => {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment