Skip to content

Commit

Permalink
chore: Update API endpoint URLs in chat component
Browse files Browse the repository at this point in the history
  • Loading branch information
HarshitShukla-dev committed Jul 15, 2024
1 parent e7fea8b commit b2c93ce
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,20 +26,20 @@ export class ChatComponent implements OnInit {

this.loggedInUsername = this.cookieService.get('loggedInUsername');

setInterval(() => {
this.http
.get<{ msgs: any[] }>('http://edventure.azurewebsites.net/api/v1/group/getmsgs', {
params: { loggedInUsername: this.loggedInUsername }
})
.subscribe({
next: (response) => {
this.messages = response.msgs; // Changed from response.messages to response.msgs
},
error: (error) => {
console.error('Error fetching messages:', error);
}
});
}, 1000);
// setInterval(() => {
// this.http
// .get<{ msgs: any[] }>('https://edventure.azurewebsites.net/api/v1/group/getmsgs', {
// params: { loggedInUsername: this.loggedInUsername }
// })
// .subscribe({
// next: (response) => {
// this.messages = response.msgs; // Changed from response.messages to response.msgs
// },
// error: (error) => {
// console.error('Error fetching messages:', error);
// }
// });
// }, 1000);
}

sendMessage() {
Expand All @@ -52,7 +52,7 @@ export class ChatComponent implements OnInit {
}; // create the body of the request

this.http
.post('http://edventure.azurewebsites.net/api/v1/group/msgGroup', body)
.post('https://edventure.azurewebsites.net/api/v1/group/msgGroup', body)
.subscribe({
next: (response) => {
console.log('Message sent:', response);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export class DashboardNavComponent {
constructor(public http: HttpClient, private router: Router) { }

logout() {
this.http.get("http://edventure.azurewebsites.net/api/v1/user/logout",{withCredentials:true}).subscribe(
this.http.get("https://edventure.azurewebsites.net/api/v1/user/logout",{withCredentials:true}).subscribe(
() => {
// Success: delete all cookies for domain 'localhost' and path '/'
// Assuming you're using ngx-cookie-service
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export class HomeComponent implements OnInit {
}

checkCookie(): void {
this.http.post("http://edventure.azurewebsites.net/api/v1/user/checkCookie", {}, {withCredentials: true}).subscribe(
this.http.post("https://edventure.azurewebsites.net/api/v1/user/checkCookie", {}, {withCredentials: true}).subscribe(
(response: any) => {
if(response.msg == "Log in Success")
this.router.navigate(['/dashboard'])
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export class LoginComponent {
this.body.username = form.value.email;
this.body.password = form.value.password;
this.http
.post('http://edventure.azurewebsites.net/api/v1/user/signin', this.body, {withCredentials: true})
.post('https://edventure.azurewebsites.net/api/v1/user/signin', this.body, {withCredentials: true})
.subscribe((response: any) => {
this.state = response.msg;
if(this.state == "Log In Success"){
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ export class SignupComponent {
this.userData.email = email;
this.setotp.email = email;
this.http
.post('http://edventure.azurewebsites.net/api/v1/user/getotp', body)
.post('https://edventure.azurewebsites.net/api/v1/user/getotp', body)
.subscribe((response: any) => {
this.state = response.msg;
});
Expand All @@ -86,7 +86,7 @@ export class SignupComponent {
this.setotp.method = 'signup';
// Send a request to the server to verify the OTP
this.http
.post('http://edventure.azurewebsites.net/api/v1/user/verifyotp', this.setotp)
.post('https://edventure.azurewebsites.net/api/v1/user/verifyotp', this.setotp)
.subscribe((response: any) => {
console.log(response);
this.state = response.msg;
Expand All @@ -101,7 +101,7 @@ export class SignupComponent {
if (form.valid) {
this.userData.educational_institute = form.value.college;
this.http
.post('http://edventure.azurewebsites.net/api/v1/user/signup', this.userData)
.post('https://edventure.azurewebsites.net/api/v1/user/signup', this.userData)
.subscribe((response: any) => {
this.state = response.msg;
console.log(response)
Expand Down

0 comments on commit b2c93ce

Please sign in to comment.