Skip to content

armgit / plane

Public Imported from GitHub
0

πŸ”₯πŸ”₯πŸ”₯ Open-source Jira, Linear, Monday, and ClickUp alternative. Plane is a modern project management platform to manage tasks, sprints, docs, and triage.

chore: bypass interceptors for unauthorized errors for few auth related endpoints (#6351)

Prateek Shourya71ebe5ca36c8
diff --git a/packages/services/src/auth/auth.service.ts b/packages/services/src/auth/auth.service.ts
index a451009407..1890533d2e 100644
--- a/packages/services/src/auth/auth.service.ts
+++ b/packages/services/src/auth/auth.service.ts
@@ -22,9 +22,10 @@ export class AuthService extends APIService {
* Requests a CSRF token for form submission security
* @returns {Promise<ICsrfTokenData>} Object containing the CSRF token
* @throws {Error} Throws the complete error object if the request fails
+ * @remarks This method uses the validateStatus: null option to bypass interceptors for unauthorized errors.
*/
async requestCSRFToken(): Promise<ICsrfTokenData> {
- return this.get("/auth/get-csrf-token/")
+ return this.get("/auth/get-csrf-token/", { validateStatus: null })
.then((response) => response.data)
.catch((error) => {
throw error;
diff --git a/packages/services/src/instance/instance.service.ts b/packages/services/src/instance/instance.service.ts
index 23cc0150dc..637c81cad0 100644
--- a/packages/services/src/instance/instance.service.ts
+++ b/packages/services/src/instance/instance.service.ts
@@ -29,9 +29,10 @@ export class InstanceService extends APIService {
* Retrieves information about the current instance
* @returns {Promise<IInstanceInfo>} Promise resolving to instance information
* @throws {Error} If the API request fails
+ * @remarks This method uses the validateStatus: null option to bypass interceptors for unauthorized errors.
*/
async info(): Promise<IInstanceInfo> {
- return this.get("/api/instances/")
+ return this.get("/api/instances/", { validateStatus: null })
.then((response) => response.data)
.catch((error) => {
throw error?.response?.data;
@@ -55,9 +56,10 @@ export class InstanceService extends APIService {
* Fetches the list of instance admins
* @returns {Promise<IInstanceAdmin[]>} Promise resolving to an array of instance admins
* @throws {Error} If the API request fails
+ * @remarks This method uses the validateStatus: null option to bypass interceptors for unauthorized errors.
*/
async admins(): Promise<IInstanceAdmin[]> {
- return this.get("/api/instances/admins/")
+ return this.get("/api/instances/admins/", { validateStatus: null })
.then((response) => response.data)
.catch((error) => {
throw error?.response?.data;
diff --git a/packages/services/src/user/user.service.ts b/packages/services/src/user/user.service.ts
index 7f956683fe..016c2e7e67 100644
--- a/packages/services/src/user/user.service.ts
+++ b/packages/services/src/user/user.service.ts
@@ -22,9 +22,10 @@ export class UserService extends APIService {
* Retrieves the current instance admin details
* @returns {Promise<IUser>} Promise resolving to the current instance admin details
* @throws {Error} If the API request fails
+ * @remarks This method uses the validateStatus: null option to bypass interceptors for unauthorized errors.
*/
async adminDetails(): Promise<IUser> {
- return this.get("/api/instances/admins/me/")
+ return this.get("/api/instances/admins/me/", { validateStatus: null })
.then((response) => response?.data)
.catch((error) => {
throw error?.response?.data;