sureshanaparti commented on code in PR #11191:
URL: https://github.com/apache/cloudstack/pull/11191#discussion_r2204229857


##########
ui/src/utils/request.js:
##########
@@ -163,6 +165,26 @@ service.interceptors.request.use(config => {
       config.params.ignoreproject = null
     }
   }
+
+  // Handle POST requests (data)
+  if (config && config.data && config.data instanceof URLSearchParams) {
+    const project = vueProps.$localStorage.get(CURRENT_PROJECT)
+    const command = config.data.get('command')
+    const hasProjectId = config.data.has('projectid')
+    const ignoreProject = config.data.has('ignoreproject')
+
+    if (!hasProjectId && !ignoreProject && project && project.id) {
+      if (command === 'listTags') {
+        config.data.append('projectid', '-1')
+      } else if (command !== 'assignVirtualMachine') {
+        config.data.append('projectid', project.id)
+      }
+    }
+    if (config.data.has('ignoreproject')) {
+      config.data.delete('ignoreproject')
+    }

Review Comment:
   @vishesh92 can we move this project check to a method 



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to