Skip to content
This repository has been archived by the owner on Jan 30, 2023. It is now read-only.

Does this addon work with ember octane versions ? #467

Open
SandeepJoel opened this issue Jun 27, 2022 · 3 comments
Open

Does this addon work with ember octane versions ? #467

SandeepJoel opened this issue Jun 27, 2022 · 3 comments

Comments

@SandeepJoel
Copy link

Got the error "Could not find module jquery imported from ember-ajax/utils/ajax" while executing the below function call.

return this.ajax
.request('/api/token', {
  method: 'POST',
  // url: '/api/token',
  data: payloadData,
})
.then((result) => {
  return result.token;
})
.catch(function (error) {
  console.log('Api failure', error);
});

Doing ember install @ember/jquery seems to fix this issue. Why is this fix needed ?

@webark
Copy link
Contributor

webark commented Jun 27, 2022

do you really want to know..? 🥴

@SandeepJoel
Copy link
Author

Atleast have we documented this somewhere in this repo ?

@webark
Copy link
Contributor

webark commented Jul 1, 2022

import jQuery from 'jquery';
const ajax =
typeof FastBoot === 'undefined' ? jQuery.ajax : FastBoot.require('najax');
export default ajax;

you can see here that it's just importing jquery to use as its ajax method.

Don't think it's documented anymore. There's an ember-ajax-fetch which has a very similar api but uses fetch.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants