From ba81b6480ccb605c14dd58e62c3a52c682998a6f Mon Sep 17 00:00:00 2001 From: Bifeldy Date: Sun, 21 May 2023 01:01:17 +0900 Subject: [PATCH] =?UTF-8?q?=E2=9C=94=20Router=20URL?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../_pages/berkas/berkas-detail/berkas-detail.component.ts | 4 ++-- .../_pages/create/berkas-create/berkas-create.component.ts | 2 +- .../_pages/dorama/dorama-detail/dorama-detail.component.ts | 2 +- .../_pages/fansub/fansub-detail/fansub-detail.component.ts | 2 +- .../nihongo/nihongo-belajar/nihongo-belajar.component.ts | 2 +- src/app/_shared/components/quiz/quiz.component.ts | 4 ++-- src/app/_shared/components/report/report.component.ts | 4 ++-- .../components/right-panel/live-chat/live-chat.component.ts | 4 ++-- src/app/_shared/interceptors/http-response.interceptor.ts | 4 ++-- src/app/_shared/services/page-info.service.ts | 2 +- src/app/_shared/services/stats-server.service.ts | 2 +- src/app/app.component.ts | 4 ++-- 12 files changed, 18 insertions(+), 18 deletions(-) diff --git a/src/app/_pages/berkas/berkas-detail/berkas-detail.component.ts b/src/app/_pages/berkas/berkas-detail/berkas-detail.component.ts index 4edc4c82d..5c3c95032 100644 --- a/src/app/_pages/berkas/berkas-detail/berkas-detail.component.ts +++ b/src/app/_pages/berkas/berkas-detail/berkas-detail.component.ts @@ -120,7 +120,7 @@ export class BerkasDetailComponent implements OnInit, OnDestroy { login(): void { this.router.navigate(['/login'], { queryParams: { - returnUrl: this.router.url + returnUrl: this.router.url.split('?')[0] } }); } @@ -128,7 +128,7 @@ export class BerkasDetailComponent implements OnInit, OnDestroy { verify(): void { this.router.navigate(['/verify'], { queryParams: { - returnUrl: this.router.url + returnUrl: this.router.url.split('?')[0] } }); } diff --git a/src/app/_pages/create/berkas-create/berkas-create.component.ts b/src/app/_pages/create/berkas-create/berkas-create.component.ts index 34ae46e5d..f0b7660d9 100644 --- a/src/app/_pages/create/berkas-create/berkas-create.component.ts +++ b/src/app/_pages/create/berkas-create/berkas-create.component.ts @@ -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] } }); } diff --git a/src/app/_pages/dorama/dorama-detail/dorama-detail.component.ts b/src/app/_pages/dorama/dorama-detail/dorama-detail.component.ts index 41022f750..ce5920672 100644 --- a/src/app/_pages/dorama/dorama-detail/dorama-detail.component.ts +++ b/src/app/_pages/dorama/dorama-detail/dorama-detail.component.ts @@ -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(); diff --git a/src/app/_pages/fansub/fansub-detail/fansub-detail.component.ts b/src/app/_pages/fansub/fansub-detail/fansub-detail.component.ts index b76b0fbe5..cd1939bc2 100644 --- a/src/app/_pages/fansub/fansub-detail/fansub-detail.component.ts +++ b/src/app/_pages/fansub/fansub-detail/fansub-detail.component.ts @@ -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] } }); } diff --git a/src/app/_pages/nihongo/nihongo-belajar/nihongo-belajar.component.ts b/src/app/_pages/nihongo/nihongo-belajar/nihongo-belajar.component.ts index 8c66f0f3d..218848b55 100644 --- a/src/app/_pages/nihongo/nihongo-belajar/nihongo-belajar.component.ts +++ b/src/app/_pages/nihongo/nihongo-belajar/nihongo-belajar.component.ts @@ -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] } }); } diff --git a/src/app/_shared/components/quiz/quiz.component.ts b/src/app/_shared/components/quiz/quiz.component.ts index da5619a5f..ea5eb6944 100644 --- a/src/app/_shared/components/quiz/quiz.component.ts +++ b/src/app/_shared/components/quiz/quiz.component.ts @@ -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 { @@ -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 }); diff --git a/src/app/_shared/components/report/report.component.ts b/src/app/_shared/components/report/report.component.ts index 8964aac5f..f906347cc 100644 --- a/src/app/_shared/components/report/report.component.ts +++ b/src/app/_shared/components/report/report.component.ts @@ -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 diff --git a/src/app/_shared/components/right-panel/live-chat/live-chat.component.ts b/src/app/_shared/components/right-panel/live-chat/live-chat.component.ts index 5961590c9..465fd5490 100644 --- a/src/app/_shared/components/right-panel/live-chat/live-chat.component.ts +++ b/src/app/_shared/components/right-panel/live-chat/live-chat.component.ts @@ -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; @@ -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] } }); } diff --git a/src/app/_shared/interceptors/http-response.interceptor.ts b/src/app/_shared/interceptors/http-response.interceptor.ts index cd3e557ee..2d57a63bf 100644 --- a/src/app/_shared/interceptors/http-response.interceptor.ts +++ b/src/app/_shared/interceptors/http-response.interceptor.ts @@ -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; @@ -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; diff --git a/src/app/_shared/services/page-info.service.ts b/src/app/_shared/services/page-info.service.ts index 74cc63be8..d9f632d03 100644 --- a/src/app/_shared/services/page-info.service.ts +++ b/src/app/_shared/services/page-info.service.ts @@ -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' }); } } diff --git a/src/app/_shared/services/stats-server.service.ts b/src/app/_shared/services/stats-server.service.ts index 0d104d38c..65a0162f3 100644 --- a/src/app/_shared/services/stats-server.service.ts +++ b/src/app/_shared/services/stats-server.service.ts @@ -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', () => { diff --git a/src/app/app.component.ts b/src/app/app.component.ts index 25a4d7bbb..23bed1af4 100644 --- a/src/app/app.component.ts +++ b/src/app/app.component.ts @@ -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` : ''; } @@ -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 => {