Skip to content

Commit f65c780

Browse files
authored
Merge pull request #488 from hashtopolis/1265-properly-implement-cors
Improved network error message to include CORS message
2 parents aa1d03b + ef56477 commit f65c780

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/app/core/_interceptors/http-res.interceptor.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,10 @@ export class HttpResInterceptor implements HttpInterceptor {
5252
} else if (error.status === 404 && !req.url.includes('config.json')) {
5353
errmsg = `The requested URL was not found.`;
5454
} else if (error.status === 0) {
55+
const frontendBaseURL = window.location.href.split('/').slice(0, 3).join('/');
5556
errmsg = `Network error. Please verify the IP address (${this.extractIpAndPort(
5657
req.url
57-
)}) and try again. Note: APIv2 HASHTOPOLIS_APIV2_ENABLE=1 needs to be enabled. `;
58+
)}) and try again. Also the following options must be set in the .env file: HASHTOPOLIS_APIV2_ENABLE=1 and HASHTOPOLIS_FRONTEND_URLS must include the used Hashtopolis frontend: ${frontendBaseURL} `;
5859
} else {
5960
errmsg = error.error?.title || 'An unknown error occurred.';
6061
}

0 commit comments

Comments
 (0)