diff options
author | Rory& <root@rory.gay> | 2024-01-24 02:31:56 +0100 |
---|---|---|
committer | Rory& <root@rory.gay> | 2024-01-24 17:05:25 +0100 |
commit | 03313562d21d5db9bf6a14ebbeab80e06c883d3a (patch) | |
tree | e000546a2ee8e6a886a7ed9fd01ad674178fb7cb /MatrixUtils.Web/Classes/SessionStorageProviderService.cs | |
parent | Make RMU installable (diff) | |
download | MatrixUtils-03313562d21d5db9bf6a14ebbeab80e06c883d3a.tar.xz |
MRU->RMU, fixes, cleanup
Diffstat (limited to 'MatrixUtils.Web/Classes/SessionStorageProviderService.cs')
-rw-r--r-- | MatrixUtils.Web/Classes/SessionStorageProviderService.cs | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/MatrixUtils.Web/Classes/SessionStorageProviderService.cs b/MatrixUtils.Web/Classes/SessionStorageProviderService.cs new file mode 100644 index 0000000..ae0bb79 --- /dev/null +++ b/MatrixUtils.Web/Classes/SessionStorageProviderService.cs @@ -0,0 +1,28 @@ +using Blazored.SessionStorage; +using LibMatrix.Interfaces.Services; + +namespace MatrixUtils.Web.Classes; + +public class SessionStorageProviderService : IStorageProvider { + private readonly ISessionStorageService _sessionStorageService; + + public SessionStorageProviderService(ISessionStorageService sessionStorage) { + _sessionStorageService = sessionStorage; + } + + Task IStorageProvider.SaveAllChildrenAsync<T>(string key, T value) { + throw new NotImplementedException(); + } + + Task<T?> IStorageProvider.LoadAllChildrenAsync<T>(string key) where T : default => throw new NotImplementedException(); + + async Task IStorageProvider.SaveObjectAsync<T>(string key, T value) => await _sessionStorageService.SetItemAsync(key, value); + + async Task<T?> IStorageProvider.LoadObjectAsync<T>(string key) where T : default => await _sessionStorageService.GetItemAsync<T>(key); + + async Task<bool> IStorageProvider.ObjectExistsAsync(string key) => await _sessionStorageService.ContainKeyAsync(key); + + async Task<List<string>> IStorageProvider.GetAllKeysAsync() => (await _sessionStorageService.KeysAsync()).ToList(); + + async Task IStorageProvider.DeleteObjectAsync(string key) => await _sessionStorageService.RemoveItemAsync(key); +} |