Skip to content

Commit 88ed169

Browse files
committed
fix session saving
1 parent 4915070 commit 88ed169

File tree

2 files changed

+5
-7
lines changed

2 files changed

+5
-7
lines changed

Oak.Cli/Program.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
using System.Reflection;
2-
using System.Text.Json;
32
using Common.Shared;
43
using ConsoleAppFramework;
54
using Microsoft.Extensions.DependencyInjection;
65
using Microsoft.Extensions.Logging;
6+
using Newtonsoft.Json;
77
using Oak.Api;
88
using Oak.Cli;
99
using ZLogger;
@@ -37,7 +37,7 @@
3737
var stateStr = File.ReadAllText(stateFilePath);
3838
if (!stateStr.IsNullOrEmpty())
3939
{
40-
state = JsonSerializer.Deserialize<State>(stateStr);
40+
state = JsonConvert.DeserializeObject<State>(stateStr);
4141
if (state == null || state.BaseHref.IsNullOrEmpty())
4242
{
4343
state = new State();
@@ -73,4 +73,5 @@
7373
app.UseFilter<StateFilter>();
7474
app.Add<App>("app");
7575
app.Add<Auth>("auth");
76+
app.Add<Org>("org");
7677
await app.RunAsync(args);

Oak.Cli/StateFilter.cs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
using System.Reflection;
2-
using System.Text.Json;
32
using ConsoleAppFramework;
3+
using Newtonsoft.Json;
44

55
namespace Oak.Cli;
66

@@ -25,10 +25,7 @@ public override async Task InvokeAsync(ConsoleAppContext ctx, CancellationToken
2525
);
2626
var stateDir = Path.Join(appDataDir, name);
2727
var filePath = Path.Join(stateDir, "state.json");
28-
var stateJson = JsonSerializer.Serialize(
29-
state,
30-
new JsonSerializerOptions { WriteIndented = true }
31-
);
28+
var stateJson = JsonConvert.SerializeObject(state, Formatting.Indented);
3229
await File.WriteAllTextAsync(filePath, stateJson, ctkn);
3330
}
3431
}

0 commit comments

Comments
 (0)