File tree 8 files changed +20
-13
lines changed
8 files changed +20
-13
lines changed Original file line number Diff line number Diff line change
1
+ namespace HyperCache . Web . Constants ;
2
+
3
+ public class ApiConstant
4
+ {
5
+ public const string BaseUrl = "https://localhost:7148" ;
6
+ public const string CustomProperties = "api/customproperties" ;
7
+ public const string CustomPropertiesPaged = "api/customproperties/paged" ;
8
+ public const string CustomPropertiesSearch = "api/customproperties/search" ;
9
+ public const string CustomPropertiesAll = "api/customproperties/all" ;
10
+ }
Original file line number Diff line number Diff line change 11
11
<PackageReference Include =" Microsoft.AspNetCore.Components.WebAssembly.DevServer" Version =" 9.0.0" PrivateAssets =" all" />
12
12
</ItemGroup >
13
13
14
- <ItemGroup >
15
- <ProjectReference Include =" ..\HyperCache.Shared\HyperCache.Shared.csproj" />
16
- </ItemGroup >
17
-
18
14
</Project >
Original file line number Diff line number Diff line change 1
1
<div class =" top-row ps-3 navbar navbar-dark" >
2
2
<div class =" container-fluid" >
3
- <a class =" navbar-brand" href =" " >HyperCache.Web </a >
3
+ <a class =" navbar-brand" href =" " >HyperCache</a >
4
4
<button title =" Navigation menu" class =" navbar-toggler" @onclick =" ToggleNavMenu" >
5
5
<span class =" navbar-toggler-icon" ></span >
6
6
</button >
Original file line number Diff line number Diff line change 1
1
@page " /property-details/{id}"
2
- @using HyperCache .Shared .Dtos
3
- @inject HttpClient Http
4
2
5
3
<div class =" container mt-4" >
6
4
<h3 class =" text-primary" >Property Details</h3 >
35
33
{
36
34
if (! string .IsNullOrEmpty (Id ))
37
35
{
38
- property = await Http .GetFromJsonAsync <CustomPropertyDto >($" CustomProperties/{Id }" );
36
+ property = await Http .GetFromJsonAsync <CustomPropertyDto >($" { ApiConstant . CustomProperties } /{Id }" );
39
37
}
40
38
}
41
39
}
Original file line number Diff line number Diff line change 1
1
@page " /search"
2
- @using HyperCache .Shared .Dtos
3
- @inject HttpClient Http
4
2
5
3
<div class =" container mt-4" >
6
4
<h3 class =" text-primary" >Search Custom Properties</h3 >
44
42
{
45
43
if (! string .IsNullOrWhiteSpace (searchKeyword ))
46
44
{
47
- properties = await Http .GetFromJsonAsync <List <CustomPropertyDto >>($" CustomProperties/search ?keyword={searchKeyword }" );
45
+ properties = await Http .GetFromJsonAsync <List <CustomPropertyDto >>($" { ApiConstant . CustomPropertiesSearch } ?keyword={searchKeyword }" );
48
46
}
49
47
}
50
48
}
Original file line number Diff line number Diff line change 1
1
using HyperCache . Web ;
2
+ using HyperCache . Web . Constants ;
2
3
using Microsoft . AspNetCore . Components . Web ;
3
4
using Microsoft . AspNetCore . Components . WebAssembly . Hosting ;
4
5
5
6
var builder = WebAssemblyHostBuilder . CreateDefault ( args ) ;
6
7
builder . RootComponents . Add < App > ( "#app" ) ;
7
8
builder . RootComponents . Add < HeadOutlet > ( "head::after" ) ;
8
9
9
- builder . Services . AddScoped ( sp => new HttpClient { BaseAddress = new Uri ( "https://localhost:7148/api/" ) } ) ;
10
+ builder . Services . AddScoped ( sp => new HttpClient { BaseAddress = new Uri ( ApiConstant . BaseUrl ) } ) ;
10
11
11
12
await builder . Build ( ) . RunAsync ( ) ;
Original file line number Diff line number Diff line change 8
8
@using Microsoft .JSInterop
9
9
@using HyperCache .Web
10
10
@using HyperCache .Web .Layout
11
+
12
+ @inject HttpClient Http
13
+ @using HyperCache .Web .Constants
14
+ @using HyperCache .Web .Dtos
Original file line number Diff line number Diff line change 4
4
< head >
5
5
< meta charset ="utf-8 " />
6
6
< meta name ="viewport " content ="width=device-width, initial-scale=1.0 " />
7
- < title > HyperCache.Web </ title >
7
+ < title > HyperCache</ title >
8
8
< base href ="/ " />
9
9
< link rel ="stylesheet " href ="lib/bootstrap/dist/css/bootstrap.min.css " />
10
10
< link rel ="stylesheet " href ="css/app.css " />
You can’t perform that action at this time.
0 commit comments