From e89f9f74fe2921fa508afe7dfaf658489487fbaf Mon Sep 17 00:00:00 2001 From: ryan Date: Fri, 28 Jul 2023 20:19:59 +0000 Subject: [PATCH] get note name from api --- Controllers/ApiController.cs | 2 +- wwwroot/js/site.js | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/Controllers/ApiController.cs b/Controllers/ApiController.cs index 2112ea0..54a5c03 100644 --- a/Controllers/ApiController.cs +++ b/Controllers/ApiController.cs @@ -12,6 +12,6 @@ namespace BinaryDad.Notes.Controllers this.noteService = noteService; } - public string Note() => noteService.Get(); + public string Note(string noteName) => noteService.GetText(noteName); } } diff --git a/wwwroot/js/site.js b/wwwroot/js/site.js index 62482a4..18182aa 100644 --- a/wwwroot/js/site.js +++ b/wwwroot/js/site.js @@ -54,10 +54,11 @@ $(function () { $textarea.val(content); showToast('#update-indicator'); }); + // update content after reconnected connection.onreconnected(function() { - $.get('api/note', function(content) { + $.get(`api/note?noteName=${noteName}`, function(content) { $textarea.val(content); showToast('#update-indicator'); console.log('Refreshed after disconnect');