[WEB-3066] refactor: replace Space Services with Services Package (#6353)

* [WEB-3066] refactor: replace Space Services with Services Package

* chore: minor improvements

* fix: type

---------

Co-authored-by: sriram veeraghanta <veeraghanta.sriram@gmail.com>
This commit is contained in:
Prateek Shourya 2025-01-11 15:16:11 +05:30 committed by GitHub
parent 39ca600091
commit ade4d290f5
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
66 changed files with 1002 additions and 631 deletions

View file

@ -34,7 +34,19 @@ export abstract class APIService {
(error) => {
if (error.response && error.response.status === 401) {
const currentPath = window.location.pathname;
window.location.replace(`/${currentPath ? `?next_path=${currentPath}` : ``}`);
let prefix = "";
let updatedPath = currentPath;
// Check for special path prefixes
if (currentPath.startsWith("/god-mode")) {
prefix = "/god-mode";
updatedPath = currentPath.replace("/god-mode", "");
} else if (currentPath.startsWith("/spaces")) {
prefix = "/spaces";
updatedPath = currentPath.replace("/spaces", "");
}
window.location.replace(`${prefix}${updatedPath ? `?next_path=${updatedPath}` : ""}`);
}
return Promise.reject(error);
}