-
Notifications
You must be signed in to change notification settings - Fork 124
Fixed: Plateform Automation Update #4837
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
||
<style scoped> | ||
|
||
</style> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The provided code contains no errors, irregularities, or optimization suggestions. It adheres to best practices and appears to have been well-written for use in modern TypeScript environments.
@@ -67,7 +67,7 @@ export default { | |||
if (!this.canSubmit || !this.isSystemAdmin) { | |||
return this.$message.error(this.$tc('NoPermission')) | |||
} | |||
this.$axios.patch(`${this.url}${this.object.id}/`, validValues).then(() => { | |||
this.$axios.patch(`${this.url}`, validValues).then(() => { | |||
this.$message.success(this.$tc('UpdateSuccessMsg')) | |||
}) | |||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The key difference between the two versions is at line #67. The patch request in version 1 does not include validValues
directly; instead, it calls the method with no arguments using $axios.get
. This might lead to an incorrect result because without passing a data object, the axios method will make a GET and then proceed to save without validation.
Inversion of control:
@override
To improve this behavior, add validValues in the method's call when you create an instance:
import {createInstance} from './instanceController';
...
let instance = createInstance(); // Add "validValues"
Then,
- this.$axios.patch('/path/to/endpoint', Object.assign({}, {...requestOptions, 'body': validValues}));
This approach ensures that all requests sent do indeed contain validated payload before proceeding through Axios' route. Remember that Axios uses a combination of the headers and body properties on the request to decide whether or not to send the request to a server side endpoint. If neither are provided in a POST message, there'd be an HTTP error sending the request because no information was passed about what content type to expect back from the API.
Regarding other issues and optimizations, I would recommend looking into specific details within your project as they can potentially help spot errors like typos or unexpected bugs that may cause issues elsewhere in your application.
@@ -113,6 +113,7 @@ export default { | |||
} | |||
}, | |||
username: { | |||
label: this.$t('Account'), | |||
width: '120px' | |||
}, | |||
risk: { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The above code snippet is written for creating a form with custom components.
There is no explicit error or inconsistency that I can detect from the given text block. It seems to be a JSON object definition without any apparent bugs. If you need help with more complex queries, feel free to ask!
|
Fixed: Plateform Automation Update