Skip to content
This repository has been archived by the owner on Oct 2, 2024. It is now read-only.

Commit

Permalink
Merge pull request #235 from wrth1337/234-beim-neu-laden-der-seite-er…
Browse files Browse the repository at this point in the history
…halten-wir-einen-nginx-404-not-found-error

fix #2234-beim-neu-laden-der-seite-erhalten-wir-einen-nginx-404-not-f…
  • Loading branch information
marcel951 authored Mar 17, 2024
2 parents 1d579b8 + 459a192 commit d2a4b45
Show file tree
Hide file tree
Showing 7 changed files with 58 additions and 4 deletions.
1 change: 1 addition & 0 deletions frontend/mycargonaut/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ RUN npm run build --prod
# Stage 2: Serve the Angular application using Nginx
FROM nginx:latest
COPY --from=build app/dist/mycargonaut /usr/share/nginx/html
COPY ./nginx.conf /etc/nginx/conf.d/default.conf

EXPOSE 80
EXPOSE 443
Expand Down
42 changes: 42 additions & 0 deletions frontend/mycargonaut/nginx.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
server {
listen 80;
listen [::]:80;
server_name localhost;

location / {
root /usr/share/nginx/html;
try_files $uri $uri/ /index.html;
index index.html index.htm;
}
#error_page 404 /404.html;

# redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}

# proxy the PHP scripts to Apache listening on 127.0.0.1:80
#
#location ~ \.php$ {
# proxy_pass http://127.0.0.1;
#}

# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
#location ~ \.php$ {
# root html;
# fastcgi_pass 127.0.0.1:9000;
# fastcgi_index index.php;
# fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;
# include fastcgi_params;
#}

# deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
#
#location ~ /\.ht {
# deny all;
#}
}
2 changes: 1 addition & 1 deletion frontend/mycargonaut/src/app/chat/chat.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -116,5 +116,5 @@

</div>

<app-rating [userWhoWasEvaluated]="this.userToRateId" [bookingId]="this.bookingToRateId" *ngIf="isOwner"></app-rating>
<app-rating [userWhoWasEvaluated]="this.userToRateId" [bookingId]="this.bookingToRateId" [userIsDriver]="this.isDriver" *ngIf="isOwner"></app-rating>

8 changes: 7 additions & 1 deletion frontend/mycargonaut/src/app/chat/chat.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ export class ChatComponent implements OnInit {
notEnoughCoins = false;
userToRateId = 0;
bookingToRateId = 0;
isDriver = false;

constructor(
private api: ApiService,
Expand Down Expand Up @@ -169,6 +170,11 @@ export class ChatComponent implements OnInit {
setRateInfos(booking: any) {
this.userToRateId = booking.userId;
this.bookingToRateId = booking.bookingId;
}

this.api.getRequest('ad/' + this.adId + '/type').subscribe((res: any) => {
if (res.data == 'offer') {
this.isDriver = true;
}
});
}
}
2 changes: 1 addition & 1 deletion frontend/mycargonaut/src/app/main/ad/ad.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -288,4 +288,4 @@ <h5 class="card-title adCardTitle p-1">{{writeTitle(ad)}}</h5>
</div>
</div>

<app-rating [userWhoWasEvaluated]="this.ad.userId" [bookingId]="this.adUserBooking.bookingId" *ngIf="this.adUserBooking"></app-rating>
<app-rating [userWhoWasEvaluated]="this.ad.userId" [bookingId]="this.adUserBooking.bookingId" [userIsDriver]="this.isDriver" *ngIf="this.adUserBooking"></app-rating>
5 changes: 5 additions & 0 deletions frontend/mycargonaut/src/app/main/ad/ad.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ export class AdComponent implements OnInit{
stars: number[] = [1, 2, 3, 4, 5];
adUserBooking:any;
bookingDone = false;
isDriver= false;

constructor(
private route: ActivatedRoute,
Expand All @@ -66,6 +67,9 @@ export class AdComponent implements OnInit{
this.api.getRequest('ad/' + res.data.adId + '/type').subscribe((res2: any) => {
this.ad.type = res2.data;
this.type = res2.data;
if (this.type == 'wanted'){
this.isDriver = true;
}
this.api.getRequest(res2.data + '/' + res.data.adId).subscribe((typeSpecRes:any) => {
this.typeSpecificContent = typeSpecRes.data;
})
Expand All @@ -75,6 +79,7 @@ export class AdComponent implements OnInit{
})
if (this.isLogin) this.getState();
})

}

getState(){
Expand Down
2 changes: 1 addition & 1 deletion frontend/mycargonaut/src/app/rating/rating.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export class RatingComponent {
@Input() userWhoIsEvaluating: any;
@Input() bookingId: any;
@Input() userWhoWasEvaluated: any;
userIsDriver = false;
@Input() userIsDriver: any;

constructor(private api: ApiService) {}

Expand Down

0 comments on commit d2a4b45

Please sign in to comment.