Removes the dummy data

This commit is contained in:
Vazhin Tayeb 2021-01-17 12:14:14 +03:00
parent 43596d741e
commit dac893275a
2 changed files with 12 additions and 38 deletions

View File

@ -34,6 +34,15 @@ namespace OidcSamples.TrafficPoliceApi
{ {
JwtSecurityTokenHandler.DefaultInboundClaimTypeMap["sub"] = "sub"; JwtSecurityTokenHandler.DefaultInboundClaimTypeMap["sub"] = "sub";
services.AddCors(options =>
{
options.AddPolicy(name: "Default",
builder =>
{
builder.AllowAnyHeader().AllowAnyOrigin().AllowAnyMethod();
});
});
services.AddDbContext<ApplicationDbContext>(options => services.AddDbContext<ApplicationDbContext>(options =>
options.UseNpgsql(Configuration.GetConnectionString("DefaultConnection")) options.UseNpgsql(Configuration.GetConnectionString("DefaultConnection"))
.UseSnakeCaseNamingConvention() .UseSnakeCaseNamingConvention()
@ -87,6 +96,8 @@ namespace OidcSamples.TrafficPoliceApi
app.UseRouting(); app.UseRouting();
app.UseCors("Default");
// 2. Enable authentication middleware // 2. Enable authentication middleware
app.UseAuthentication(); app.UseAuthentication();
app.UseAuthorization(); app.UseAuthorization();

View File

@ -16,44 +16,7 @@ const VehiclesMain = () => {
const history = useHistory(); const history = useHistory();
// Initial state must be null ** Temporary ** const [vehicleData, setVehicleData] = useState(null);
const [vehicleData, setVehicleData] = useState([
{
id: Math.floor(Math.random() * 200) + 1,
color: "White",
model: "Toyota Camry",
licensePlate: "14324235",
type: 2,
},
{
id: Math.floor(Math.random() * 200) + 1,
color: "Black",
model: "Honda Accord",
licensePlate: "8765658",
type: 1,
},
{
id: Math.floor(Math.random() * 200) + 1,
color: "Beige",
model: "Toyota Corolla",
licensePlate: "235464",
type: 2,
},
{
id: Math.floor(Math.random() * 200) + 1,
color: "Grey",
model: "Toyota Yaris",
licensePlate: "1878767",
type: 2,
},
{
id: Math.floor(Math.random() * 200) + 1,
color: "White",
model: "Toyota Camry",
licensePlate: "9956443",
type: 1,
},
]);
useEffect(() => { useEffect(() => {
getVehicles(); getVehicles();