Skip to content

Commit c3a8b94

Browse files
committed
fix logic bug deactive router
1 parent b3e3a93 commit c3a8b94

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

src/app/features/excercise/exercise-pages/code-submission/code-submission.component.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ export class CodeSubmissionComponent {
129129

130130
canDeactivate(): Observable<boolean> {
131131
if (!this.codeEditorComponent.getCode()) return of(true);
132-
if (this.codeEditorComponent.getCode()) {
132+
if (this.codeEditorComponent.getCode() && !this.submitted) {
133133
return this.modalNoticeService.confirm(
134134
'Xác nhận thoát',
135135
'Bạn có chắc muốn thoát? Dữ liệu sẽ mất.',

src/app/shared/store/modal-notice-state/modal-notice.service.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ export class ModalNoticeService {
1515
confirmText: string,
1616
cancelText: string
1717
): Observable<boolean> {
18+
this.decision$ = new Subject<boolean>();
1819
this.store.dispatch(
1920
openNoticeModal({
2021
payload: {

0 commit comments

Comments
 (0)