Skip to content
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

do not format advanced json in admin panel #157

Merged
merged 2 commits into from
Mar 23, 2024
Merged

Conversation

kbats183
Copy link
Contributor

No description provided.

call.respondFile(Config.cdsSettings.advancedJsonPath.toFile())
try {
call.respondFile(Config.cdsSettings.advancedJsonPath.toFile())
} catch (e: IOException) {
Copy link
Contributor

@kunyavskiy kunyavskiy Mar 17, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd say it is better to check on exists() instead of catching an exception. IOException, can occur because of different reasons unrealaed to files (like, failing to write answer to socket)

@@ -14,11 +14,11 @@ export const useLocalStorageState = (key, defaultValue) => {
};

export const createApiPost = (apiUrl) =>
function (path, body = {}, method = "POST") {
function (path, body = {}, method = "POST", sendRaw = false) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

At one point in time we might have a huge number of parameters for this function.
I think there are two nice solutions to keeping the code nice and tidy:

  1. Use 3rd party library like Axios
  2. Move all parameters to a single object and invoke the function like this:
apiPost("", constn, "POST", {
sendRaw: true
});

That way we can have more parameters that are not required

@kbats183 kbats183 merged commit 31819e2 into main Mar 23, 2024
2 checks passed
@kunyavskiy kunyavskiy deleted the admin/advanced-editor branch April 21, 2024 06:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants