mirror of
https://github.com/OneUptime/oneuptime.git
synced 2026-04-06 00:32:12 +02:00
fix: update forbidden route handling to prevent navigation errors and return null
This commit is contained in:
@@ -119,10 +119,11 @@ class BaseAPI extends API {
|
||||
if (
|
||||
error instanceof HTTPErrorResponse &&
|
||||
error.statusCode === 403 &&
|
||||
this.getForbiddenRoute() &&
|
||||
Navigation.getCurrentRoute().toString() !==
|
||||
this.getForbiddenRoute().toString()
|
||||
this.getForbiddenRoute()?.toString()
|
||||
) {
|
||||
Navigation.navigate(this.getForbiddenRoute(), { forceNavigate: true });
|
||||
Navigation.navigate(this.getForbiddenRoute()!, { forceNavigate: true });
|
||||
}
|
||||
|
||||
return error;
|
||||
@@ -132,8 +133,8 @@ class BaseAPI extends API {
|
||||
return new Route("/accounts/login");
|
||||
}
|
||||
|
||||
protected static getForbiddenRoute(): Route {
|
||||
return new Route("/accounts/forbidden");
|
||||
protected static getForbiddenRoute(): Route | null {
|
||||
return null;
|
||||
}
|
||||
|
||||
public static getFriendlyMessage(
|
||||
|
||||
Reference in New Issue
Block a user