#Disable JS Object Functions on a Page

1 messages · Page 1 of 1 (latest)

formal shuttle
#

Is there a way to disable JS Object functions on a page with out actually being on that page?

I recently added a new function in my app that checks for user auth on page load to make sure the Appsmith internal user's token is not expired.

Here is the new function within my 'Monitor' page.

checkAuth: () => {
validateSSOToken.run()
.then(() => {Api.run()} )
.catch(() => {
storeValue('idToken', undefined)
navigateTo('Sign In')
})
}

The issue is that my 'validateSSOToken' API's bearer token is incorrect so it ALWAYS returns a 401. Therefore, the function always hits the catch statement and redirects me to the 'Sign In' page immediately. So, even when i'm in the edit mode of Appsmith the 'Monitor' page is inaccessible. I can't do anything in the page. I don't have any previous copies of the app and i'm not version controlling on Git.

Please help!

broken jewelBOT
#

Hi Alexia!
A simple workaround for this is to add a debugger to the sign-in page. After
adding the debugger as JS execution stopped, you can move to the page where you
wanted to change the code and modify it.

Another workaround is to export the app, manually change the JSON file, then
reimport it.

Please also upvote and comment on this feature request to help us prioritize it:
https://github.com/appsmithorg/appsmith/issues/12423

GitHub

Is there an existing issue for this? I have searched the existing issues Summary When a user tries to write a page load query that contains logic to navigate some other page. If the logic is not co...

formal shuttle
#

Awesome! Thank you.

broken jewelBOT
broken jewelBOT
#

Sorry for the delay. You need to create an async JS function in a JS Object of
the login page and add there a debugger statement. Set this function to Run on
Page Load in the Settings tab.
Then you open the browsers console and click on the first page; it will redirect
you to the login page, where it will pause. You should then be able to click on
the first page and edit the JS Object and correct your code.