mirror of
https://github.com/ditkrg/AuthorizationServerDemos.git
synced 2026-01-22 23:46:54 +00:00
Changes styling of Tax App & Changes TP API route
This commit is contained in:
parent
d053835810
commit
1c8d003401
@ -4,11 +4,17 @@
|
|||||||
ViewData["Title"] = "Home page";
|
ViewData["Title"] = "Home page";
|
||||||
}
|
}
|
||||||
|
|
||||||
<h2>General Directorate of Region Taxes and Real Estate</h2>
|
<h1 class="col-lg-7 mt-5">General Directorate of Region Taxes and Real Estate</h1>
|
||||||
<p class="lead">Welcome @Model.FirstName @Model.LastName! Your total tax is:</p>
|
<div class="col-lg-7 d-flex flex-column">
|
||||||
<p class="font-weight-bold" style="font-size: 64px">@Model.TotalTax.ToString("N0") IQD</p>
|
<p class="lead mt-2">Welcome @Model.FirstName @Model.LastName!</p>
|
||||||
|
<div class="bg-dark rounded py-3 px-4 mt-4">
|
||||||
|
<h2 class="font-weight-bold mt-3 text-warning">Your total tax is:</h2>
|
||||||
|
<p class="font-weight-bold text-light" style="font-size: 64px">@Model.TotalTax.ToString("N0") IQD</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<h3>Taxable Properties</h3>
|
<h3>Taxable Properties</h3>
|
||||||
|
|
||||||
<h4>Vehicles</h4>
|
<h4>Vehicles</h4>
|
||||||
<ul>
|
<ul>
|
||||||
@foreach (var vehicle in Model.Vehicles)
|
@foreach (var vehicle in Model.Vehicles)
|
||||||
|
|||||||
@ -85,7 +85,7 @@ namespace OidcSamples.TaxApp
|
|||||||
// create an HttpClient used for accessing the API
|
// create an HttpClient used for accessing the API
|
||||||
services.AddHttpClient("APIClient", client =>
|
services.AddHttpClient("APIClient", client =>
|
||||||
{
|
{
|
||||||
client.BaseAddress = new Uri("http://localhost:6000/");
|
client.BaseAddress = new Uri("http://localhost:9000/");
|
||||||
client.DefaultRequestHeaders.Clear();
|
client.DefaultRequestHeaders.Clear();
|
||||||
client.DefaultRequestHeaders.Add(HeaderNames.Accept, "application/json");
|
client.DefaultRequestHeaders.Add(HeaderNames.Accept, "application/json");
|
||||||
}).AddHttpMessageHandler<BearerTokenHandler>();
|
}).AddHttpMessageHandler<BearerTokenHandler>();
|
||||||
|
|||||||
@ -22,7 +22,7 @@
|
|||||||
"dotnetRunMessages": "true",
|
"dotnetRunMessages": "true",
|
||||||
"launchBrowser": true,
|
"launchBrowser": true,
|
||||||
"launchUrl": "swagger",
|
"launchUrl": "swagger",
|
||||||
"applicationUrl": "http://localhost:6000",
|
"applicationUrl": "http://localhost:9000",
|
||||||
"environmentVariables": {
|
"environmentVariables": {
|
||||||
"ASPNETCORE_ENVIRONMENT": "Development"
|
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||||
}
|
}
|
||||||
|
|||||||
1102
Node/real-estate/package-lock.json
generated
1102
Node/real-estate/package-lock.json
generated
File diff suppressed because it is too large
Load Diff
16286
React/real-estate/package-lock.json
generated
16286
React/real-estate/package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@ -1,5 +1,6 @@
|
|||||||
import React, { useState } from "react";
|
import React, { useState } from "react";
|
||||||
import { useSelector } from "react-redux";
|
import { useSelector } from "react-redux";
|
||||||
|
import { useHistory } from "react-router-dom";
|
||||||
|
|
||||||
// Services
|
// Services
|
||||||
import * as apiService from "../../services/apiService";
|
import * as apiService from "../../services/apiService";
|
||||||
@ -19,12 +20,14 @@ const VehicleRegisterForm = () => {
|
|||||||
|
|
||||||
const user = useSelector((state) => state.auth.user);
|
const user = useSelector((state) => state.auth.user);
|
||||||
|
|
||||||
|
const history = useHistory();
|
||||||
|
|
||||||
async function registerVehicle() {
|
async function registerVehicle() {
|
||||||
await apiService.registerVehicle(
|
await apiService.registerVehicle(
|
||||||
{ model, licensePlate, color, type },
|
{ model, licensePlate, color, type },
|
||||||
user.access_token
|
user.access_token
|
||||||
);
|
);
|
||||||
// await getVehicles();
|
history.push("/");
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
@ -1,17 +1,20 @@
|
|||||||
import axios from 'axios'
|
import axios from "axios";
|
||||||
|
|
||||||
async function getVehiclesFromApi(access_token) {
|
async function getVehiclesFromApi(access_token) {
|
||||||
const response = await axios.get(`https://localhost:6001/api/Vehicles`, { headers: { 'Authorization': `Bearer ${access_token}` } });
|
const response = await axios.get(`http://localhost:9000/api/Vehicles`, {
|
||||||
|
headers: { Authorization: `Bearer ${access_token}` },
|
||||||
|
});
|
||||||
return response.data;
|
return response.data;
|
||||||
}
|
}
|
||||||
|
|
||||||
async function registerVehicle(vehicle, access_token) {
|
async function registerVehicle(vehicle, access_token) {
|
||||||
console.log(vehicle);
|
console.log(vehicle);
|
||||||
const response = await axios.post(`https://localhost:6001/api/Vehicles`, vehicle, { headers: { 'Authorization': `Bearer ${access_token}` } });
|
const response = await axios.post(
|
||||||
|
`http://localhost:9000/api/Vehicles`,
|
||||||
|
vehicle,
|
||||||
|
{ headers: { Authorization: `Bearer ${access_token}` } }
|
||||||
|
);
|
||||||
return response.data;
|
return response.data;
|
||||||
}
|
}
|
||||||
|
|
||||||
export {
|
export { getVehiclesFromApi, registerVehicle };
|
||||||
getVehiclesFromApi,
|
|
||||||
registerVehicle
|
|
||||||
}
|
|
||||||
|
|||||||
@ -1,46 +1,48 @@
|
|||||||
import { UserManager } from 'oidc-client';
|
import { UserManager } from "oidc-client";
|
||||||
import { storeUserError, storeUser } from '../actions/authActions'
|
import { storeUserError, storeUser } from "../actions/authActions";
|
||||||
|
|
||||||
const config = {
|
const config = {
|
||||||
authority: "https://localhost:10000",
|
authority: "http://localhost:10000",
|
||||||
client_id: "traffic-police-react-app",
|
client_id: "traffic-police-react-app",
|
||||||
redirect_uri: "https://localhost:3000/signin-oidc",
|
redirect_uri: "http://localhost:3000/signin-oidc",
|
||||||
response_type: "code",
|
response_type: "code",
|
||||||
scope: "openid profile traffic-police-api",
|
scope: "openid profile traffic-police-api",
|
||||||
post_logout_redirect_uri: "https://localhost:3000/signout-oidc",
|
post_logout_redirect_uri: "http://localhost:3000/signout-oidc",
|
||||||
};
|
};
|
||||||
|
|
||||||
const userManager = new UserManager(config)
|
const userManager = new UserManager(config);
|
||||||
|
|
||||||
export async function loadUserFromStorage(store) {
|
export async function loadUserFromStorage(store) {
|
||||||
try {
|
try {
|
||||||
let user = await userManager.getUser()
|
let user = await userManager.getUser();
|
||||||
if (!user) { return store.dispatch(storeUserError()) }
|
if (!user) {
|
||||||
store.dispatch(storeUser(user))
|
return store.dispatch(storeUserError());
|
||||||
|
}
|
||||||
|
store.dispatch(storeUser(user));
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.error(`User not found: ${e}`)
|
console.error(`User not found: ${e}`);
|
||||||
store.dispatch(storeUserError())
|
store.dispatch(storeUserError());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export function signinRedirect() {
|
export function signinRedirect() {
|
||||||
return userManager.signinRedirect()
|
return userManager.signinRedirect();
|
||||||
}
|
}
|
||||||
|
|
||||||
export function signinRedirectCallback() {
|
export function signinRedirectCallback() {
|
||||||
return userManager.signinRedirectCallback()
|
return userManager.signinRedirectCallback();
|
||||||
}
|
}
|
||||||
|
|
||||||
export function signoutRedirect() {
|
export function signoutRedirect() {
|
||||||
userManager.clearStaleState()
|
userManager.clearStaleState();
|
||||||
userManager.removeUser()
|
userManager.removeUser();
|
||||||
return userManager.signoutRedirect()
|
return userManager.signoutRedirect();
|
||||||
}
|
}
|
||||||
|
|
||||||
export function signoutRedirectCallback() {
|
export function signoutRedirectCallback() {
|
||||||
userManager.clearStaleState()
|
userManager.clearStaleState();
|
||||||
userManager.removeUser()
|
userManager.removeUser();
|
||||||
return userManager.signoutRedirectCallback()
|
return userManager.signoutRedirectCallback();
|
||||||
}
|
}
|
||||||
|
|
||||||
export default userManager
|
export default userManager;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user