| 
					
				 | 
			
			
				@@ -1,5 +1,6 @@ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import { Component, OnInit } from '@angular/core'; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import { AlertController } from '@ionic/angular'; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import { Router } from '@angular/router'; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import * as Parse from 'parse'; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 interface Memo { 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -21,7 +22,7 @@ export class MemoPage implements OnInit { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   username: string = ''; // Current user's username 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   nextMemoId: number = 1; // Track next memoId for the current user 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-  constructor(private alertController: AlertController) {} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  constructor(private alertController: AlertController, private router: Router) {} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   ngOnInit() { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     const currentUser = Parse.User.current(); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -34,17 +35,6 @@ export class MemoPage implements OnInit { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-  ionViewDidEnter() { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    const currentUser = Parse.User.current(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    if (currentUser) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-      this.username = currentUser.getUsername()!; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-      this.loadMemos(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-      this.loadNextMemoId(); // Load the next memoId for the current user 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    } else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-      console.error('User not logged in.'); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-  } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   async loadNextMemoId() { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     try { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       const query = new Parse.Query('memo_history'); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -147,4 +137,9 @@ export class MemoPage implements OnInit { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       console.error('Error deleting memo', error); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  // Navigate to memo-history page 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  navigateToMemoHistory() { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    this.router.navigate(['/tabs/memo-history']); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 } 
			 |