Skip to content

Commit

Permalink
✔ Router URL
Browse files Browse the repository at this point in the history
  • Loading branch information
bifeldy committed May 20, 2023
1 parent c8c6762 commit ba81b64
Show file tree
Hide file tree
Showing 12 changed files with 18 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -120,15 +120,15 @@ export class BerkasDetailComponent implements OnInit, OnDestroy {
login(): void {
this.router.navigate(['/login'], {
queryParams: {
returnUrl: this.router.url
returnUrl: this.router.url.split('?')[0]
}
});
}

verify(): void {
this.router.navigate(['/verify'], {
queryParams: {
returnUrl: this.router.url
returnUrl: this.router.url.split('?')[0]
}
});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -577,7 +577,7 @@ export class BerkasCreateComponent implements OnInit, OnDestroy {
verify(): void {
this.router.navigate(['/verify'], {
queryParams: {
returnUrl: this.router.url
returnUrl: this.router.url.split('?')[0]
}
});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ export class DoramaDetailComponent implements OnInit, OnDestroy {
this.fs.initializeFab(
null,
'/assets/img/logo/mdl.png', 'Buka Di MyDramaList',
`https://mydramalist.com/${this.router.url.split('/')[this.router.url.split('/').length - 1]}`,
`https://mydramalist.com/${this.router.url.split('?')[0].split('/')[this.router.url.split('?')[0].split('/').length - 1]}`,
true
);
this.getFansubDorama();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -564,7 +564,7 @@ export class FansubDetailComponent implements OnInit, OnDestroy {
} else {
this.router.navigate(['/login'], {
queryParams: {
returnUrl: this.router.url
returnUrl: this.router.url.split('?')[0]
}
});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ export class NihongoBelajarComponent implements OnInit, OnDestroy {
this.toast.warning('Khusus Pengguna Terverifikasi', 'Whoops!', null, true);
this.router.navigate(['/verify'], {
queryParams: {
returnUrl: this.router.url
returnUrl: this.router.url.split('?')[0]
}
});
}
Expand Down
4 changes: 2 additions & 2 deletions src/app/_shared/components/quiz/quiz.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ export class QuizComponent implements OnInit, OnDestroy {
}

get getQuiz(): any {
return this.quiz.getCurrentQuizQuestion(this.router.url);
return this.quiz.getCurrentQuizQuestion(this.router.url.split('?')[0]);
}

ngOnDestroy(): void {
Expand All @@ -73,7 +73,7 @@ export class QuizComponent implements OnInit, OnDestroy {

selectAnswer(data: any): void {
this.quiz.answerQuestion({
roomId: this.router.url,
roomId: this.router.url.split('?')[0],
randomInteger: this.getQuiz.randomInteger,
answer: data
});
Expand Down
4 changes: 2 additions & 2 deletions src/app/_shared/components/report/report.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -169,8 +169,8 @@ export class ReportComponent implements OnInit, OnDestroy {

ngOnInit(): void {
if (this.gs.isBrowser) {
this.reportTrackType = this.router.url.split('/')[1];
this.idSlugUsername = this.router.url.split('/')[2];
this.reportTrackType = this.router.url.split('?')[0].split('/')[1];
this.idSlugUsername = this.router.url.split('?')[0].split('/')[2];
this.ss.socketEmit('track-get', {
trackType: this.reportTrackType,
idSlugUsername: this.idSlugUsername
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ export class LiveChatComponent implements OnInit, AfterViewInit, OnDestroy {
ngOnInit(): void {
if (this.gs.isBrowser) {
this.liveChatResult = this.ls.getItem(this.gs.localStorageKeys.LiveChatResults, true) || this.liveChatResult;
this.liveChatResult.roomId = this.router.url;
this.liveChatResult.roomId = this.router.url.split('?')[0];
this.subsCurrentRoom = this.ss.currentRoom.subscribe({
next: current => {
this.currentRoom = current;
Expand Down Expand Up @@ -194,7 +194,7 @@ export class LiveChatComponent implements OnInit, AfterViewInit, OnDestroy {
login(): void {
this.router.navigate(['/login'], {
queryParams: {
returnUrl: this.router.url
returnUrl: this.router.url.split('?')[0]
}
});
}
Expand Down
4 changes: 2 additions & 2 deletions src/app/_shared/interceptors/http-response.interceptor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ export class HttpResponseInterceptor implements HttpInterceptor {
this.bs.idle();
this.router.navigate(['/login'], {
queryParams: {
returnUrl: this.router.url || '/'
returnUrl: this.router.url.split('?')[0] || '/'
}
});
break;
Expand All @@ -116,7 +116,7 @@ export class HttpResponseInterceptor implements HttpInterceptor {
this.bs.idle();
this.router.navigate(['/verify'], {
queryParams: {
returnUrl: this.router.url || '/'
returnUrl: this.router.url.split('?')[0] || '/'
}
});
break;
Expand Down
2 changes: 1 addition & 1 deletion src/app/_shared/services/page-info.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ export class PageInfoService {
this.m.updateTag({ name: 'twitter:description', content: this.description });
}
this.m.updateTag({ name: 'twitter:image', content: this.image });
if (this.router.url.includes('/berkas/') && !this.image.includes(environment.baseUrl)) {
if (this.router.url.split('?')[0].includes('/berkas/') && !this.image.includes(environment.baseUrl)) {
this.m.updateTag({ name: 'twitter:card', content: 'summary_large_image' });
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/app/_shared/services/stats-server.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ export class StatsServerService {
this.pingPong();
this.notif.removeNotif(`${environment.siteName.toUpperCase()}_SOCKET_DISCONNECTED`);
this.timedOut = setTimeout(() => {
this.socketLeaveAndJoinNewRoom(null, this.router.url);
this.socketLeaveAndJoinNewRoom(null, this.router.url.split('?')[0]);
}, 1234);
});
this.mySocket.on('connect_error', () => {
Expand Down
4 changes: 2 additions & 2 deletions src/app/app.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ export class AppComponent implements OnInit, AfterViewInit, OnDestroy {
}

updateBackgroundImage(): void {
const urlPath = this.router.url.substring(1).split('/')[0].split('?')[0];
const urlPath = this.router.url.split('?')[0].substring(1).split('/')[0];
this.gs.bgImgUrlPath = urlPath ? `/assets/img/router/${urlPath}.png` : '';
}

Expand All @@ -246,7 +246,7 @@ export class AppComponent implements OnInit, AfterViewInit, OnDestroy {
this.subsVerify = this.as.verify(this.as.token).subscribe({
next: success => {
this.gs.log('[VERIFY_SUCCESS]', success);
this.ss.socketLeaveAndJoinNewRoom(this.gs.previousUrl, this.router.url);
this.ss.socketLeaveAndJoinNewRoom(this.gs.previousUrl, this.router.url.split('?')[0]);
this.bs.idle();
},
error: error => {
Expand Down

0 comments on commit ba81b64

Please sign in to comment.