diff options
| author | ivarlovlie <git@ivarlovlie.no> | 2022-12-22 14:44:26 +0100 |
|---|---|---|
| committer | ivarlovlie <git@ivarlovlie.no> | 2022-12-22 14:44:26 +0100 |
| commit | 58ef5833b3f77f321c587dd86448c888029016ce (patch) | |
| tree | fe5e6f47781573cc1fb5938f9b8cd8b51022946a /code/api/Models/KnownProblem.cs | |
| parent | 82ade3c31fb17b662feec59e9e654ceb66edbb7a (diff) | |
| download | storage-58ef5833b3f77f321c587dd86448c888029016ce.tar.xz storage-58ef5833b3f77f321c587dd86448c888029016ce.zip | |
feat: Many things
- Working Login/Logout
- Groundwork for web components
- Loading web-components with version tag
- Load temporal-polyfill globally
Diffstat (limited to 'code/api/Models/KnownProblem.cs')
| -rw-r--r-- | code/api/Models/KnownProblem.cs | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/code/api/Models/KnownProblem.cs b/code/api/Models/KnownProblem.cs new file mode 100644 index 0000000..007f79a --- /dev/null +++ b/code/api/Models/KnownProblem.cs @@ -0,0 +1,26 @@ +namespace I2R.Storage.Api.Models; + +public class KnownProblemModel +{ + public KnownProblemModel(string title = default, string subtitle = default, Dictionary<string, string[]> errors = default) { + Title = title; + Subtitle = subtitle; + Errors = errors ?? new Dictionary<string, string[]>(); + } + + public string Title { get; set; } + public string Subtitle { get; set; } + public Dictionary<string, string[]> Errors { get; set; } + public string TraceId { get; set; } + + public void AddError(string field, string errorText) { + if (!Errors.ContainsKey(field)) { + Errors.Add(field, new[] {errorText}); + } else { + var currentErrors = Errors[field]; + var newErrors = currentErrors.Concat(new[] {errorText}); + Errors.Remove(field); + Errors.Add(field, newErrors.ToArray()); + } + } +}
\ No newline at end of file |
