mimetype added. Thanks page added
This commit is contained in:
9
app.go
9
app.go
@@ -1,6 +1,7 @@
|
|||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"mime"
|
||||||
"path"
|
"path"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
|
|
||||||
@@ -20,6 +21,7 @@ type App struct {
|
|||||||
func (a *App) start() {
|
func (a *App) start() {
|
||||||
a.db.AutoMigrate(&planner.Besucher{})
|
a.db.AutoMigrate(&planner.Besucher{})
|
||||||
a.r.Use(CORSMiddleware())
|
a.r.Use(CORSMiddleware())
|
||||||
|
a.r.Use(HEADERMiddleWare())
|
||||||
a.r.SetTrustedProxies(a.proxyips)
|
a.r.SetTrustedProxies(a.proxyips)
|
||||||
a.r.NoRoute((func(c *gin.Context) {
|
a.r.NoRoute((func(c *gin.Context) {
|
||||||
dir, file := path.Split(c.Request.RequestURI)
|
dir, file := path.Split(c.Request.RequestURI)
|
||||||
@@ -46,6 +48,13 @@ func (a *App) start() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func HEADERMiddleWare() gin.HandlerFunc {
|
||||||
|
return func(c *gin.Context) {
|
||||||
|
mime.AddExtensionType(".js", "application/javascript")
|
||||||
|
c.Next()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func CORSMiddleware() gin.HandlerFunc {
|
func CORSMiddleware() gin.HandlerFunc {
|
||||||
return func(c *gin.Context) {
|
return func(c *gin.Context) {
|
||||||
c.Writer.Header().Set("Access-Control-Allow-Origin", "*")
|
c.Writer.Header().Set("Access-Control-Allow-Origin", "*")
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import { BesucherComponent } from './besucher/besucher.component';
|
|||||||
import { ContactComponent } from './contact/contact.component';
|
import { ContactComponent } from './contact/contact.component';
|
||||||
import { HomeComponent } from './home/home.component';
|
import { HomeComponent } from './home/home.component';
|
||||||
import { LocationComponent } from './location/location.component';
|
import { LocationComponent } from './location/location.component';
|
||||||
|
import { ThanksComponent } from './thanks/thanks.component';
|
||||||
import { WegbeschreibungComponent } from './wegbeschreibung/wegbeschreibung.component';
|
import { WegbeschreibungComponent } from './wegbeschreibung/wegbeschreibung.component';
|
||||||
|
|
||||||
const routes: Routes = [
|
const routes: Routes = [
|
||||||
@@ -12,7 +13,8 @@ const routes: Routes = [
|
|||||||
{ path: 'client',component: BesucherComponent},
|
{ path: 'client',component: BesucherComponent},
|
||||||
{ path: 'unserfest',component: LocationComponent},
|
{ path: 'unserfest',component: LocationComponent},
|
||||||
{ path: 'contact', component: ContactComponent},
|
{ path: 'contact', component: ContactComponent},
|
||||||
{path:'wegbeschreibung', component: WegbeschreibungComponent}
|
{ path: 'wegbeschreibung', component: WegbeschreibungComponent},
|
||||||
|
{ path: 'thanks', component: ThanksComponent}
|
||||||
];
|
];
|
||||||
|
|
||||||
@NgModule({
|
@NgModule({
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ import { LocationComponent } from './location/location.component';
|
|||||||
import { ContactComponent } from './contact/contact.component';
|
import { ContactComponent } from './contact/contact.component';
|
||||||
import { DisclaimerComponent } from './disclaimer/disclaimer.component';
|
import { DisclaimerComponent } from './disclaimer/disclaimer.component';
|
||||||
import { WegbeschreibungComponent } from './wegbeschreibung/wegbeschreibung.component';
|
import { WegbeschreibungComponent } from './wegbeschreibung/wegbeschreibung.component';
|
||||||
|
import { ThanksComponent } from './thanks/thanks.component';
|
||||||
|
|
||||||
@NgModule({
|
@NgModule({
|
||||||
declarations: [
|
declarations: [
|
||||||
@@ -29,7 +30,8 @@ import { WegbeschreibungComponent } from './wegbeschreibung/wegbeschreibung.comp
|
|||||||
LocationComponent,
|
LocationComponent,
|
||||||
ContactComponent,
|
ContactComponent,
|
||||||
DisclaimerComponent,
|
DisclaimerComponent,
|
||||||
WegbeschreibungComponent
|
WegbeschreibungComponent,
|
||||||
|
ThanksComponent
|
||||||
],
|
],
|
||||||
imports: [
|
imports: [
|
||||||
BrowserModule,
|
BrowserModule,
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import { MatRadioModule } from '@angular/material/radio';
|
|||||||
import { filter } from 'rxjs';
|
import { filter } from 'rxjs';
|
||||||
import { BesucherService } from '../besucher.service';
|
import { BesucherService } from '../besucher.service';
|
||||||
import { Besucher } from 'src/besucher';
|
import { Besucher } from 'src/besucher';
|
||||||
|
import { Router, ActivatedRoute } from '@angular/router';
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -25,7 +26,7 @@ export class BesucherComponent implements OnInit {
|
|||||||
BesucherKommtRadio: string = "";
|
BesucherKommtRadio: string = "";
|
||||||
kommt: string[] = ['Ja','Nein'];
|
kommt: string[] = ['Ja','Nein'];
|
||||||
|
|
||||||
constructor(private besucherService: BesucherService) {
|
constructor(private besucherService: BesucherService, private route: Router ) {
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnInit(): void {
|
ngOnInit(): void {
|
||||||
@@ -36,19 +37,10 @@ export class BesucherComponent implements OnInit {
|
|||||||
getAll() {
|
getAll() {
|
||||||
this.besucherService.getBesucherList().subscribe((data: Besucher[]) => {
|
this.besucherService.getBesucherList().subscribe((data: Besucher[]) => {
|
||||||
this.activeBesuchers = data;
|
this.activeBesuchers = data;
|
||||||
console.log(data);
|
//console.log(data);
|
||||||
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
/*getAll() {
|
|
||||||
this.besucherService.getBesucherList()
|
|
||||||
.pipe(
|
|
||||||
filter((data): data is Besucher[] => data instanceof Besucher))
|
|
||||||
.subscribe(data => {
|
|
||||||
this.activeBesuchers = data.filter((a) => !a.come);
|
|
||||||
this.kommendeBesuchers = data.filter((a) => a.come);
|
|
||||||
});
|
|
||||||
}*/
|
|
||||||
|
|
||||||
addBesucher() {
|
addBesucher() {
|
||||||
var newBesucher : Besucher = {
|
var newBesucher : Besucher = {
|
||||||
@@ -57,10 +49,12 @@ export class BesucherComponent implements OnInit {
|
|||||||
id: '',
|
id: '',
|
||||||
come : this.convertBesucherkommtStringToBoolean(this.BesucherKommtRadio)
|
come : this.convertBesucherkommtStringToBoolean(this.BesucherKommtRadio)
|
||||||
};
|
};
|
||||||
console.log(newBesucher.come);
|
|
||||||
this.besucherService.addBesucher(newBesucher).subscribe(() => {
|
this.besucherService.addBesucher(newBesucher).subscribe(() => {
|
||||||
this.getAll();
|
|
||||||
this.BesucherMessage = '';
|
this.BesucherMessage = '';
|
||||||
|
this.BesucherName = '';
|
||||||
|
this.route.navigate(['/thanks']);
|
||||||
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
0
ui/src/app/thanks/thanks.component.css
Normal file
0
ui/src/app/thanks/thanks.component.css
Normal file
3
ui/src/app/thanks/thanks.component.html
Normal file
3
ui/src/app/thanks/thanks.component.html
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
<h1>Vielen Dank!</h1>
|
||||||
|
<h4>Ihre Nachricht wurde versendet!</h4>
|
||||||
|
<h5>Klicken Sie <a routerLink="/home">hier</a> um zur Startseite zu kommen</h5>
|
||||||
25
ui/src/app/thanks/thanks.component.spec.ts
Normal file
25
ui/src/app/thanks/thanks.component.spec.ts
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||||
|
|
||||||
|
import { ThanksComponent } from './thanks.component';
|
||||||
|
|
||||||
|
describe('ThanksComponent', () => {
|
||||||
|
let component: ThanksComponent;
|
||||||
|
let fixture: ComponentFixture<ThanksComponent>;
|
||||||
|
|
||||||
|
beforeEach(async () => {
|
||||||
|
await TestBed.configureTestingModule({
|
||||||
|
declarations: [ ThanksComponent ]
|
||||||
|
})
|
||||||
|
.compileComponents();
|
||||||
|
});
|
||||||
|
|
||||||
|
beforeEach(() => {
|
||||||
|
fixture = TestBed.createComponent(ThanksComponent);
|
||||||
|
component = fixture.componentInstance;
|
||||||
|
fixture.detectChanges();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should create', () => {
|
||||||
|
expect(component).toBeTruthy();
|
||||||
|
});
|
||||||
|
});
|
||||||
15
ui/src/app/thanks/thanks.component.ts
Normal file
15
ui/src/app/thanks/thanks.component.ts
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
import { Component, OnInit } from '@angular/core';
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
selector: 'app-thanks',
|
||||||
|
templateUrl: './thanks.component.html',
|
||||||
|
styleUrls: ['./thanks.component.css']
|
||||||
|
})
|
||||||
|
export class ThanksComponent implements OnInit {
|
||||||
|
|
||||||
|
constructor() { }
|
||||||
|
|
||||||
|
ngOnInit(): void {
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
export const environment = {
|
export const environment = {
|
||||||
production: false,
|
production: false,
|
||||||
gateway: '',
|
gateway: 'http://localhost:3001',
|
||||||
callback: 'http://localhost:4200/callback',
|
callback: 'http://localhost:4200/callback',
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user