@@ -18,7 +18,6 @@ namespace <#= Model.BlazorIdentityNamespace #>
18
18
MaxAge = TimeSpan.FromSeconds(5),
19
19
};
20
20
21
- [DoesNotReturn]
22
21
public void RedirectTo(string? uri)
23
22
{
24
23
uri ??= "";
@@ -32,18 +31,15 @@ namespace <#= Model.BlazorIdentityNamespace #>
32
31
// During static rendering, NavigateTo throws a NavigationException which is handled by the framework as a redirect.
33
32
// So as long as this is called from a statically rendered Identity component, the InvalidOperationException is never thrown.
34
33
navigationManager.NavigateTo(uri);
35
- throw new InvalidOperationException($"{nameof(IdentityRedirectManager)} can only be used during static rendering.");
36
34
}
37
35
38
- [DoesNotReturn]
39
36
public void RedirectTo(string uri, Dictionary<string, object?> queryParameters)
40
37
{
41
38
var uriWithoutQuery = navigationManager.ToAbsoluteUri(uri).GetLeftPart(UriPartial.Path);
42
39
var newUri = navigationManager.GetUriWithQueryParameters(uriWithoutQuery, queryParameters);
43
40
RedirectTo(newUri);
44
41
}
45
42
46
- [DoesNotReturn]
47
43
public void RedirectToWithStatus(string uri, string message, HttpContext context)
48
44
{
49
45
context.Response.Cookies.Append(StatusCookieName, message, StatusCookieBuilder.Build(context));
@@ -52,10 +48,8 @@ namespace <#= Model.BlazorIdentityNamespace #>
52
48
53
49
private string CurrentPath => navigationManager.ToAbsoluteUri(navigationManager.Uri).GetLeftPart(UriPartial.Path);
54
50
55
- [DoesNotReturn]
56
51
public void RedirectToCurrentPage() => RedirectTo(CurrentPath);
57
52
58
- [DoesNotReturn]
59
53
public void RedirectToCurrentPageWithStatus(string message, HttpContext context)
60
54
=> RedirectToWithStatus(CurrentPath, message, context);
61
55
}
0 commit comments