-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathCookieService.cs
More file actions
79 lines (61 loc) · 2.04 KB
/
CookieService.cs
File metadata and controls
79 lines (61 loc) · 2.04 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
#region using statements
using Microsoft.JSInterop;
using System.Threading.Tasks;
#endregion
namespace DataJuggler.Blazor.Components
{
#region class CookieService
/// <summary>
/// This class is used to set Cookies via JS.
/// </summary>
public class CookieService
{
#region Private Variables
private readonly IJSRuntime jsRuntime;
#endregion
#region Constructor
/// <summary>
/// Create a new instance of a 'CookieService' object.
/// </summary>
public CookieService(IJSRuntime jsRuntime)
{
this.jsRuntime = jsRuntime;
}
#endregion
#region Events
#endregion
#region Methods
#region DeleteCookieAsync(string key)
/// <summary>
/// method Delete Cookie Async
/// </summary>
public async Task DeleteCookieAsync(string key)
{
await BlazorJSBridge.DeleteCookie(jsRuntime, key);
}
#endregion
#region GetCookieAsync(string key)
/// <summary>
/// method Get Cookie Async
/// </summary>
public async Task<string> GetCookieAsync(string key)
{
return await BlazorJSBridge.GetCookie(jsRuntime, key);
}
#endregion
#region SetCookieAsync(string key, string value, int expireDays = 30)
/// <summary>
/// method Set Cookie Async
/// </summary>
public async Task SetCookieAsync(string key, string value, int expireDays = 30)
{
await BlazorJSBridge.SetCookie(jsRuntime, key, value, expireDays);
}
#endregion
#endregion
#region Properties
#endregion
}
#endregion
}