在Ember中有没有办法将请求发送到后端的cookie?
例如:如果我的客户端URL是protocol://example.com.当我导航到时,属于同一域的cookie将位于请求标头中protocol://example.com/profile.但是,它们不会在后续请求中保留配置文件路由模型方法 - >示例到protocol://example-host/posts.如何使这些cookie持续存在?
/app/routes/profile.js:
import Ember from "ember";
import AuthenticatedRouteMixin from "simple-auth/mixins/authenticated-route-mixin";
export default Ember.Route.extend({
model() {
return this.store.findAll("post");
},
renderTemplate() {
this.render("header", {
outlet: "header"
});
this.render("profile");
}
});
Run Code Online (Sandbox Code Playgroud)
/app/adapters/application:
import Ember from "ember";
import DS from "ember-data";
export default DS.RESTAdapter.extend({
host: 'http://example-host.com',
corsWithCredentials: true,
crossDomain: true,
xhrFields: { withCredentials: true }
});
Run Code Online (Sandbox Code Playgroud)