Skip to content

Commit

Permalink
fix: issue with algorithm drop down default value
Browse files Browse the repository at this point in the history
  • Loading branch information
gitcommitshow committed Jul 31, 2022
1 parent 5e1be1a commit f87b04f
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 8 deletions.
10 changes: 5 additions & 5 deletions frontend/src/app/generate-token/generate-token.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@ <h1 class="mb-5 heading">{{ "generate-token.create" | transloco }}</h1>
</p>

<form #postForm="ngForm" (ngSubmit)="onCreateToken(postForm.value)">
<select ngModel name="algo" class="rectangle">
<option selected>HS256</option>
<option>RS256</option>
<select [(ngModel)]="algo" name="algo" class="rectangle">
<option>HS256</option>
<option [selected]="true">RS256</option>
<option>ES256</option>
</select>

<p class="font-grey algo">{{"generate-token.data" | transloco}}</p>
<p class="font-grey algo">{{"generate-token.data" | transloco}}</p>

<textarea [(ngModel)]="payloadValue" name="payload" class="rectangle-1 data1"></textarea>

Expand All @@ -32,7 +32,7 @@ <h1 class="mb-5 heading">{{ "generate-token.create" | transloco }}</h1>

<div class="row">
<div class="col-auto text-end">
<button type="submit" (click)="nextStep()" class="btn btn-warning mt-5" innerHTML="{{ 'generate-token.generateToken' | transloco }}"></button>
<button type="submit" class="btn btn-warning mt-5" innerHTML="{{ 'generate-token.generateToken' | transloco }}"></button>
</div>
</div>
</form>
6 changes: 4 additions & 2 deletions frontend/src/app/generate-token/generate-token.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import { StepService } from '../shared/services/step.service';
export class GenerateTokenComponent implements OnInit {

payloadValue = '{ "data" : "We raised series A" }'
algo ="RS256"

@Input() token = ""

Expand All @@ -24,18 +25,19 @@ export class GenerateTokenComponent implements OnInit {
}

onCreateToken(postData: {algo: string, payload: string}){
console.log("Creating token for: "+JSON.stringify(postData));
this.jwtService.post(postData).subscribe({
next: (success: any)=>{
this.token = success.token
localStorage.setItem('token', this.token)
localStorage.setItem('token', this.token);
this.nextStep();
}, error: (error: any) => {
console.error('error:', error);
},
})
}

nextStep(){
this.onCreateToken
this.stepService.setStep(5)
this.router.navigate(['generate-token1'])
}
Expand Down
3 changes: 2 additions & 1 deletion frontend/src/app/jwtuses/jwtuses.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@ <h1 class="mb-5 heading">{{ "jwtusedfor.usedFor" | transloco }}</h1>
<img src="assets/images/icon-crog.svg" class="me-2" />
{{ "jwtusedfor.leverage3" | transloco }}
<br>
{{"jwtusedfor.leverage4" | transloco}}
<!--{{"jwtusedfor.leverage4" | transloco}}-->
<!--Include a drawing here to make it easier to understand-->
</p>

<p class="font-grey">{{"jwtusedfor.introduction3" | transloco}}</p>
Expand Down

0 comments on commit f87b04f

Please sign in to comment.