Skip to content

Commit

Permalink
pref(service): back logic
Browse files Browse the repository at this point in the history
  • Loading branch information
Raphaël Balet committed Aug 1, 2024
1 parent 3f343c0 commit 09ec817
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions projects/ngx-back-button/src/lib/ngx-back-button.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,13 @@ export class NgxBackButtonService {
}

back(fallback?: string): void {
fallback = this._fallbackPrefix + (fallback || this._rootUrl)

const record = this._history.pop()

if (this._history.length > 0) {
this._location.back()
} else {
try {
window.history.replaceState(null, '', fallback)
window.history.replaceState(null, '', this._fallbackPrefix + (fallback || this._rootUrl))
} catch (error) {
console.error('NgxBackButton: ' + error)
}
Expand Down

0 comments on commit 09ec817

Please sign in to comment.