A user fills out a form, that form calls an api which prompts an email. The user clicks a link in the email:
localhost:3600/doggydaycare/confirm?confirmid=clkjdkjd439827
I need to write a GET DogDoggyDayCare/DoggyDayCareStatus?doggydaycareId=clkjdkjd439827 (initial status will be 404)
Then my POST DogDoggyDayCare/DoggyDayCareConfirmEmail { “doggydaycareId”: clkjdkjd439827 }
Then hit GET again DogDoggyDayCare/DoggyDayCareStatus?doggydaycareId=clkjdkjd439827 (initial status will be 200)
I know that I need to do query parameters to grab the id clkjdkjd439827, but I can’t for the life of me sort out how to do it? Basically, this email is going to confirm their ID so they can continue in signing up for doggy day care. My head hurts, please help. My ‘postgetstarteddata’ works fine, that’s the one that gets the email. So my email arrives, but I can’t sort out what to do after that.
I got 404 not found for both of them. Please help, I’m desperate.
Service file:
import { HttpClient } from '@angular/common/http';
import { Injectable } from '@angular/core';
import { environment } from 'src/environments/environment';
@Injectable({
providedIn: 'root'
})
export class GetStartedService {
constructor(private http:HttpClient) {
}
getStatus(){
return this.http.get(environment.apiUrl + '/DogDoggyDayCare/DoggyDayCareStatus? doggydaycareId=clkjdkjd439827')
}
// onboarding basic info post -- onboarding email confirm
postConfirm(data: any){
return this.http.post(environment.apiUrl + '/DogDoggyDayCare/DoggyDayCareConfirmEmail', data)
}
// onboarding basic info post -- onboarding email
postGetStartedData(data: any){
return this.http.post(environment.apiUrl + '/DogDoggyDayCare/DoggyDayCareBasicInfo', data)
}
}
confirmation.component.ts file
import { Component } from '@angular/core';
import { ActivatedRoute } from '@angular/router';
import { GetStartedService } from 'src/app/service/get-started.service';
@Component({
selector: 'app-confirmation',
templateUrl: './confirmation.component.html',
styleUrls: ['./confirmation.component.css']
})
export class ConfirmationComponent {
doggydaycareId!: string;
constructor(private router: ActivatedRoute,
private getStatusConfirm:GetStartedService) {}
submitted = true;
ngOnInit() {
this.getStatusConfirm.getStatus().subscribe((data)=>{
console.log(data);
})
this.router.queryParams
.subscribe(params=>{
console.log(params);
this.doggydaycareId = params['doggydaycareId'];
console.log(this.doggydaycareId);
})
this.postConfirmation.postConfirm(this.doggydaycareId).subscribe((doggydaycare)=>{
console.log(doggydaycare);
})
}
}