mirror of
https://github.com/ditkrg/AuthorizationServerDemos.git
synced 2026-01-22 21:46:58 +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";
|
||||
}
|
||||
|
||||
<h2>General Directorate of Region Taxes and Real Estate</h2>
|
||||
<p class="lead">Welcome @Model.FirstName @Model.LastName! Your total tax is:</p>
|
||||
<p class="font-weight-bold" style="font-size: 64px">@Model.TotalTax.ToString("N0") IQD</p>
|
||||
<h1 class="col-lg-7 mt-5">General Directorate of Region Taxes and Real Estate</h1>
|
||||
<div class="col-lg-7 d-flex flex-column">
|
||||
<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>
|
||||
|
||||
<h4>Vehicles</h4>
|
||||
<ul>
|
||||
@foreach (var vehicle in Model.Vehicles)
|
||||
|
||||
@ -85,7 +85,7 @@ namespace OidcSamples.TaxApp
|
||||
// create an HttpClient used for accessing the API
|
||||
services.AddHttpClient("APIClient", client =>
|
||||
{
|
||||
client.BaseAddress = new Uri("http://localhost:6000/");
|
||||
client.BaseAddress = new Uri("http://localhost:9000/");
|
||||
client.DefaultRequestHeaders.Clear();
|
||||
client.DefaultRequestHeaders.Add(HeaderNames.Accept, "application/json");
|
||||
}).AddHttpMessageHandler<BearerTokenHandler>();
|
||||
|
||||
@ -22,7 +22,7 @@
|
||||
"dotnetRunMessages": "true",
|
||||
"launchBrowser": true,
|
||||
"launchUrl": "swagger",
|
||||
"applicationUrl": "http://localhost:6000",
|
||||
"applicationUrl": "http://localhost:9000",
|
||||
"environmentVariables": {
|
||||
"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 { useSelector } from "react-redux";
|
||||
import { useHistory } from "react-router-dom";
|
||||
|
||||
// Services
|
||||
import * as apiService from "../../services/apiService";
|
||||
@ -19,12 +20,14 @@ const VehicleRegisterForm = () => {
|
||||
|
||||
const user = useSelector((state) => state.auth.user);
|
||||
|
||||
const history = useHistory();
|
||||
|
||||
async function registerVehicle() {
|
||||
await apiService.registerVehicle(
|
||||
{ model, licensePlate, color, type },
|
||||
user.access_token
|
||||
);
|
||||
// await getVehicles();
|
||||
history.push("/");
|
||||
}
|
||||
|
||||
return (
|
||||
|
||||
@ -1,17 +1,20 @@
|
||||
import axios from 'axios'
|
||||
import axios from "axios";
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
async function registerVehicle(vehicle, access_token) {
|
||||
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;
|
||||
}
|
||||
|
||||
export {
|
||||
getVehiclesFromApi,
|
||||
registerVehicle
|
||||
}
|
||||
export { getVehiclesFromApi, registerVehicle };
|
||||
|
||||
@ -1,46 +1,48 @@
|
||||
import { UserManager } from 'oidc-client';
|
||||
import { storeUserError, storeUser } from '../actions/authActions'
|
||||
import { UserManager } from "oidc-client";
|
||||
import { storeUserError, storeUser } from "../actions/authActions";
|
||||
|
||||
const config = {
|
||||
authority: "https://localhost:10000",
|
||||
authority: "http://localhost:10000",
|
||||
client_id: "traffic-police-react-app",
|
||||
redirect_uri: "https://localhost:3000/signin-oidc",
|
||||
redirect_uri: "http://localhost:3000/signin-oidc",
|
||||
response_type: "code",
|
||||
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) {
|
||||
try {
|
||||
let user = await userManager.getUser()
|
||||
if (!user) { return store.dispatch(storeUserError()) }
|
||||
store.dispatch(storeUser(user))
|
||||
let user = await userManager.getUser();
|
||||
if (!user) {
|
||||
return store.dispatch(storeUserError());
|
||||
}
|
||||
store.dispatch(storeUser(user));
|
||||
} catch (e) {
|
||||
console.error(`User not found: ${e}`)
|
||||
store.dispatch(storeUserError())
|
||||
console.error(`User not found: ${e}`);
|
||||
store.dispatch(storeUserError());
|
||||
}
|
||||
}
|
||||
|
||||
export function signinRedirect() {
|
||||
return userManager.signinRedirect()
|
||||
return userManager.signinRedirect();
|
||||
}
|
||||
|
||||
export function signinRedirectCallback() {
|
||||
return userManager.signinRedirectCallback()
|
||||
return userManager.signinRedirectCallback();
|
||||
}
|
||||
|
||||
export function signoutRedirect() {
|
||||
userManager.clearStaleState()
|
||||
userManager.removeUser()
|
||||
return userManager.signoutRedirect()
|
||||
userManager.clearStaleState();
|
||||
userManager.removeUser();
|
||||
return userManager.signoutRedirect();
|
||||
}
|
||||
|
||||
export function signoutRedirectCallback() {
|
||||
userManager.clearStaleState()
|
||||
userManager.removeUser()
|
||||
return userManager.signoutRedirectCallback()
|
||||
userManager.clearStaleState();
|
||||
userManager.removeUser();
|
||||
return userManager.signoutRedirectCallback();
|
||||
}
|
||||
|
||||
export default userManager
|
||||
export default userManager;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user