Skip to content

Commit dcb6d03

Browse files
committed
WIP
1 parent 694e9e4 commit dcb6d03

File tree

4 files changed

+40
-9
lines changed

4 files changed

+40
-9
lines changed
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
Async content: {{setLater}}
1+
Async content: {{this.setLater}}
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { defer } from 'rsvp';
22
import { later } from '@ember/runloop';
3+
import fetch from 'fetch';
34
import Component from '@glimmer/component';
45
import { tracked } from '@glimmer/tracking';
56
import { inject as service } from '@ember/service';
@@ -11,13 +12,43 @@ export default class AsyncContenComponent extends Component {
1112

1213
constructor() {
1314
super(...arguments);
14-
const deferred = defer();
15+
this.loadAsync();
16+
}
17+
18+
// async loadAsync() {
19+
// if (this.fastboot.isFastBoot) {
20+
// const url = `https://www.outdoorsy.com/wp-json/wp/v2/posts?categories=1723&_embed&page=1&per_page=3`;
21+
// let request = this.apiRequest.request(url);
22+
23+
// if (this.fastboot.isFastBoot) {
24+
// this.fastboot.deferRendering(request);
25+
// }
26+
27+
// let blogContent = yield request;
28+
29+
// let processedBlog = blogContent.map(post => processPost(post));
30+
31+
// this.fastboot.shoebox.put('homepage-blog', processedBlog);
32+
// return processedBlog;
33+
// }
34+
35+
// return this.fastboot.shoebox.retrieve('homepage-blog') || defaultBlogData;
36+
// };
37+
38+
async loadAsync() {
39+
const url = 'https://swapi.dev/api/starships/12';
40+
const deferred = fetch(url);
41+
42+
if (this.fastboot.isFastBoot) {
43+
this.fastboot.deferRendering(deferred);
44+
}
45+
46+
const response = await deferred;
47+
const { model } = await response.json();
1548

16-
later(() => {
17-
this.setLater = 'Go Sounders';
18-
deferred.resolve();
19-
}, 100)
49+
debugger;
2050

21-
this.fastboot.deferRendering(deferred.promise);
51+
this.setLater = model;
52+
console.log('setLater', this.setLater);
2253
}
2354
}

test-packages/basic-app/config/environment.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ module.exports = function(environment) {
2323
},
2424

2525
fastboot: {
26-
hostAllowlist: [
26+
hostWhitelist: [
2727
'example.com',
2828
'subdomain.example.com',
2929
'/localhost:\\d+/',

test-packages/custom-fastboot-app/config/environment.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ module.exports = function(environment) {
88
locationType: 'auto',
99

1010
fastboot: {
11-
htmlFile: 'custom-index.html'
11+
htmlFile: 'custom-index.html',
1212
},
1313

1414
EmberENV: {

0 commit comments

Comments
 (0)