Merge pull request #19 from Michael-Tanzer/delete-chats
added option to delete individual chat
This commit is contained in:
		
						commit
						97432612bb
					
				| 
						 | 
				
			
			@ -150,6 +150,13 @@
 | 
			
		|||
      });
 | 
			
		||||
    }
 | 
			
		||||
  };
 | 
			
		||||
 | 
			
		||||
  const deleteChat = () => {
 | 
			
		||||
    if (confirm("Are you sure you want to delete this chat?")) {
 | 
			
		||||
      chatsStorage.update((chats) => chats.filter((chat) => chat.id !== chatId));
 | 
			
		||||
      chatId = null;
 | 
			
		||||
    }
 | 
			
		||||
  };
 | 
			
		||||
</script>
 | 
			
		||||
 | 
			
		||||
<nav class="level chat-header">
 | 
			
		||||
| 
						 | 
				
			
			@ -179,6 +186,14 @@
 | 
			
		|||
        >
 | 
			
		||||
          💡
 | 
			
		||||
        </a>
 | 
			
		||||
        <a
 | 
			
		||||
                href={"#"}
 | 
			
		||||
                class="greyscale ml-2 is-hidden editbutton"
 | 
			
		||||
                title="Delete this chat"
 | 
			
		||||
                on:click|preventDefault={deleteChat}
 | 
			
		||||
        >
 | 
			
		||||
          🗑️
 | 
			
		||||
        </a>
 | 
			
		||||
      </p>
 | 
			
		||||
    </div>
 | 
			
		||||
  </div>
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue