Skip to content

Conversation

@Dantemss
Copy link
Member

Otherwise Rails thinks it's a cross-origin request and fails.

@Dantemss Dantemss requested a review from nathanstitt February 23, 2021 23:14
@Dantemss Dantemss self-assigned this Feb 23, 2021
"GET",
"/admin/publications/collaborators?collaborators_query=" + $("#collaborators-query").val(), true
);

Copy link
Member

Choose a reason for hiding this comment

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

I have no idea why we're using old-old-old school XMLHttpRequest here. Since this will only be used by people with somewhat modern browsers, we can use fetch which is so much simpler. try this:

fetch(`/admin/publications/collaborators?collaborators_query=${$("#collaborators-query").val()}`).then((resp)  => {
   eval(resp.responseText);
});

I'm not 100% sure if the response (resp var) will have a responseText property though. You might need to put a console.log(resp) or a debugger in before the eval to play with it.

Copy link
Member Author

Choose a reason for hiding this comment

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

Updated to use fetch()

@Dantemss Dantemss merged commit 80feea8 into main Feb 26, 2021
@Dantemss Dantemss deleted the fix_admin_mass_update branch February 26, 2021 19:36
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