Skip to content

Commit

Permalink
Corrige url e nome de variável
Browse files Browse the repository at this point in the history
  • Loading branch information
geraldovictor committed Nov 14, 2023
1 parent bc00922 commit 9aa79cb
Show file tree
Hide file tree
Showing 7 changed files with 31 additions and 29 deletions.
3 changes: 2 additions & 1 deletion src/app/environment/environment.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
export const EDUPLAY_CLIENT_KEY = "a1cdba06226408fcda63b49c50223c68d56005d234cc98bcdc1ae787d2b4de1d";
export const environment = {
apiURL: 'https://unb-tv-backend-2be1ed3a0485.herokuapp.com/api',
usersAPIURL: 'https://unb-tv-backend-2be1ed3a0485.herokuapp.com/api',
adminAPIURL: 'https://admin-unb-tv-2023-2-dc0dd53d3aca.herokuapp.com/api'
};
14 changes: 7 additions & 7 deletions src/app/services/auth.service.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ describe('AuthService', () => {
service.registerUser(userResponse).subscribe(res => {
expect(res).toEqual(userResponse);
});
const req = httpMock.expectOne(`${service.apiURL}/auth/register`);
const req = httpMock.expectOne(`${service.usersAPIURL}/auth/register`);
expect(req.request.method).toBe('POST');
req.flush(userResponse);
});
Expand All @@ -44,7 +44,7 @@ describe('AuthService', () => {
service.loginUser(userResponse).subscribe(res => {
expect(res).toEqual(userResponse);
});
const req = httpMock.expectOne(`${service.apiURL}/auth/login`);
const req = httpMock.expectOne(`${service.usersAPIURL}/auth/login`);
expect(req.request.method).toBe('POST');
req.flush(userResponse);
});
Expand All @@ -57,7 +57,7 @@ describe('AuthService', () => {
service.activeAccount(userResponse).subscribe(res => {
expect(res).toEqual(userResponse);
});
const req = httpMock.expectOne(`${service.apiURL}/auth/activate-account`);
const req = httpMock.expectOne(`${service.usersAPIURL}/auth/activate-account`);
expect(req.request.method).toBe('PATCH');
req.flush(userResponse);
});
Expand All @@ -69,7 +69,7 @@ describe('AuthService', () => {
service.resendCode(userResponse).subscribe(res => {
expect(res).toEqual(userResponse);
});
const req = httpMock.expectOne(`${service.apiURL}/auth/resend-code`);
const req = httpMock.expectOne(`${service.usersAPIURL}/auth/resend-code`);
expect(req.request.method).toBe('POST');
req.flush(userResponse);
});
Expand All @@ -81,7 +81,7 @@ describe('AuthService', () => {
service.sendEmailPassword(userResponse).subscribe(res => {
expect(res).toEqual(userResponse);
});
const req = httpMock.expectOne(`${service.apiURL}/auth/reset-password/request`);
const req = httpMock.expectOne(`${service.usersAPIURL}/auth/reset-password/request`);
expect(req.request.method).toBe('POST');
req.flush(userResponse);
});
Expand All @@ -94,7 +94,7 @@ describe('AuthService', () => {
service.verifyCodePassword(userResponse).subscribe(res => {
expect(res).toEqual(userResponse);
});
const req = httpMock.expectOne(`${service.apiURL}/auth/reset-password/verify`);
const req = httpMock.expectOne(`${service.usersAPIURL}/auth/reset-password/verify`);
expect(req.request.method).toBe('POST');
req.flush(userResponse);
});
Expand All @@ -108,7 +108,7 @@ describe('AuthService', () => {
service.updatePassword(userResponse).subscribe(res => {
expect(res).toEqual(userResponse);
});
const req = httpMock.expectOne(`${service.apiURL}/auth/reset-password/change`);
const req = httpMock.expectOne(`${service.usersAPIURL}/auth/reset-password/change`);
expect(req.request.method).toBe('PATCH');
req.flush(userResponse);
});
Expand Down
16 changes: 8 additions & 8 deletions src/app/services/auth.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,36 +8,36 @@ import { Observable } from 'rxjs';
providedIn: 'root'
})
export class AuthService {
public apiURL = environment.apiURL;
public usersAPIURL = environment.usersAPIURL;

constructor(private http: HttpClient) { }

registerUser(user: any): Observable<any> {
return this.http.post(`${this.apiURL}/auth/register`, user);
return this.http.post(`${this.usersAPIURL}/auth/register`, user);
}

loginUser(user: any): Observable<any> {
return this.http.post(`${this.apiURL}/auth/login`, user);
return this.http.post(`${this.usersAPIURL}/auth/login`, user);
}

activeAccount(emailCode: any): Observable<any> {
return this.http.patch(`${this.apiURL}/auth/activate-account`, emailCode);
return this.http.patch(`${this.usersAPIURL}/auth/activate-account`, emailCode);
}

resendCode(email: any): Observable<any> {
return this.http.post(`${this.apiURL}/auth/resend-code`, email);
return this.http.post(`${this.usersAPIURL}/auth/resend-code`, email);
}

sendEmailPassword(email: any): Observable<any> {
return this.http.post(`${this.apiURL}/auth/reset-password/request`, email);
return this.http.post(`${this.usersAPIURL}/auth/reset-password/request`, email);
}

verifyCodePassword(info: any): Observable<any> {
return this.http.post(`${this.apiURL}/auth/reset-password/verify`, info);
return this.http.post(`${this.usersAPIURL}/auth/reset-password/verify`, info);
}

updatePassword(user: any): Observable<any> {
return this.http.patch(`${this.apiURL}/auth/reset-password/change`, user);
return this.http.patch(`${this.usersAPIURL}/auth/reset-password/change`, user);
}

isAuthenticated(): boolean {
Expand Down
7 changes: 4 additions & 3 deletions src/app/services/email.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,17 @@ import { Injectable } from '@angular/core';
import { HttpClient } from '@angular/common/http';
import { Observable } from 'rxjs';
import { IEmailData } from 'src/shared/model/email.model';
import { environment } from '../environment/environment';

@Injectable({
providedIn: 'root'
})
export class EmailService {
private apiUrl = 'http://localhost:8080/api/pauta/email'; // Ajuste conforme necessário
private adminAPIUrl = environment.adminAPIURL + '/pauta/email'; // Ajuste conforme necessário

constructor(private http: HttpClient) {}
constructor(private http: HttpClient) { }

sendEmail(email: IEmailData): Observable<any> {
return this.http.post(this.apiUrl, email);
return this.http.post(this.adminAPIUrl, email);
}
}
2 changes: 1 addition & 1 deletion src/app/services/user-token-interceptor.service.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ describe('TokenInterceptorService', () => {
userService.getAllUsers().subscribe((res) => {
expect(res).toBeTruthy();
});
const req = httpMock.expectOne(`${userService.apiURL}/users`);
const req = httpMock.expectOne(`${userService.usersAPIURL}/users`);
expect(req.request.headers.has('Authorization')).toEqual(true);
});
});
8 changes: 4 additions & 4 deletions src/app/services/user.service.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ describe('UserService', () => {
expect(res).toEqual(userResponse);

});
const req = httpMock.expectOne(`${service.apiURL}/users/1`);
const req = httpMock.expectOne(`${service.usersAPIURL}/users/1`);
expect(req.request.method).toBe('GET');
req.flush(userResponse);
});
Expand All @@ -56,7 +56,7 @@ describe('UserService', () => {
service.getAllUsers().subscribe(res => {
expect(res).toEqual(userResponse);
});
const req = httpMock.expectOne(`${service.apiURL}/users`);
const req = httpMock.expectOne(`${service.usersAPIURL}/users`);
expect(req.request.method).toBe('GET');
req.flush(userResponse);
}
Expand All @@ -74,7 +74,7 @@ describe('UserService', () => {
service.updateUser(1, { "name": "Mario", "connection": "PROFESSOR", "email": "[email protected]" }).subscribe(res => {
expect(res).toEqual(userResponse);
});
const req = httpMock.expectOne(`${service.apiURL}/users/1`);
const req = httpMock.expectOne(`${service.usersAPIURL}/users/1`);
expect(req.request.method).toBe('PATCH');
req.flush(userResponse);
}
Expand All @@ -92,7 +92,7 @@ describe('UserService', () => {
service.deleteUser(1).subscribe(res => {
expect(res).toEqual(userResponse);
});
const req = httpMock.expectOne(`${service.apiURL}/users/1`);
const req = httpMock.expectOne(`${service.usersAPIURL}/users/1`);
expect(req.request.method).toBe('DELETE');
req.flush(userResponse);
}
Expand Down
10 changes: 5 additions & 5 deletions src/app/services/user.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,23 +7,23 @@ import { Observable } from 'rxjs';
providedIn: 'root'
})
export class UserService {
public apiURL = environment.apiURL;
public usersAPIURL = environment.usersAPIURL;

constructor(private http: HttpClient) { }

getUser(id: any): Observable<any> {
return this.http.get(`${this.apiURL}/users/${id}`);
return this.http.get(`${this.usersAPIURL}/users/${id}`);
}

getAllUsers(): Observable<any> {
return this.http.get(`${this.apiURL}/users`);
return this.http.get(`${this.usersAPIURL}/users`);
}

updateUser(id: any, body: any): Observable<any> {
return this.http.patch(`${this.apiURL}/users/${id}`, body);
return this.http.patch(`${this.usersAPIURL}/users/${id}`, body);
}

deleteUser(id: any): Observable<any> {
return this.http.delete(`${this.apiURL}/users/${id}`);
return this.http.delete(`${this.usersAPIURL}/users/${id}`);
}
}

0 comments on commit 9aa79cb

Please sign in to comment.