mirror of https://github.com/abpframework/abp.git
8 changed files with 50 additions and 7 deletions
@ -0,0 +1,12 @@ |
|||||
|
using Volo.Abp.DependencyInjection; |
||||
|
|
||||
|
namespace Volo.Abp.AspNetCore.Components.Web |
||||
|
{ |
||||
|
public class DefaultServerUrlProvider : IServerUrlProvider, ISingletonDependency |
||||
|
{ |
||||
|
public string GetBaseUrl(string remoteServiceName = null) |
||||
|
{ |
||||
|
return "/"; |
||||
|
} |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,7 @@ |
|||||
|
namespace Volo.Abp.AspNetCore.Components.Web |
||||
|
{ |
||||
|
public interface IServerUrlProvider |
||||
|
{ |
||||
|
string GetBaseUrl(string remoteServiceName = null); |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,27 @@ |
|||||
|
using System; |
||||
|
using Microsoft.Extensions.Options; |
||||
|
using Volo.Abp.AspNetCore.Components.Web; |
||||
|
using Volo.Abp.DependencyInjection; |
||||
|
using Volo.Abp.Http.Client; |
||||
|
|
||||
|
namespace Volo.Abp.AspNetCore.Components.WebAssembly |
||||
|
{ |
||||
|
[Dependency(ReplaceServices = true)] |
||||
|
public class WebAssemblyServerUrlProvider : IServerUrlProvider, ITransientDependency |
||||
|
{ |
||||
|
public AbpRemoteServiceOptions Options { get; } |
||||
|
|
||||
|
public WebAssemblyServerUrlProvider( |
||||
|
IOptions<AbpRemoteServiceOptions> options) |
||||
|
{ |
||||
|
Options = options.Value; |
||||
|
} |
||||
|
|
||||
|
public string GetBaseUrl(string remoteServiceName = null) |
||||
|
{ |
||||
|
return Options.RemoteServices.GetConfigurationOrDefault( |
||||
|
remoteServiceName ?? RemoteServiceConfigurationDictionary.DefaultName |
||||
|
).BaseUrl.EnsureEndsWith('/'); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
Loading…
Reference in new issue