Skip to content

Commit 65fa4a3

Browse files
committed
Added the content for the quickstarts
1 parent 6711070 commit 65fa4a3

File tree

1 file changed

+41
-24
lines changed

1 file changed

+41
-24
lines changed

packages/@okta/vuepress-theme-default/layouts/Quickstart.vue

+41-24
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,10 @@
2828
</ul>
2929
</div>
3030

31-
<Content :pageKey="activeClientComponent" id="client_content" class="example-content-well"/>
31+
<div id="client_content" class="example-content-well">
32+
<div v-if="clientContentLoading">Loading... </div>
33+
<div v-else v-html="clientContent"></div>
34+
</div>
3235

3336
<h2 id="server_setup">Server Setup</h2>
3437

@@ -54,7 +57,10 @@
5457
</ul>
5558
</div>
5659

57-
<div id="server_content" class="example-content-well"></div>
60+
<div id="server_content" class="example-content-well">
61+
<div v-if="serverContentLoading">Loading... </div>
62+
<div v-else v-html="serverContent"></div>
63+
</div>
5864
</div>
5965

6066
<div class="TableOfContents TableOfContentsPreload">
@@ -64,6 +70,8 @@
6470
</div>
6571
<!-- END Page Content -->
6672
</section>
73+
<iframe style="display:none;" id="clientContentIframe" :src="clientContentUrl"></iframe>
74+
<iframe style="display:none;" id="serverContentIframe" :src="serverContentUrl"></iframe>
6775
<Footer/>
6876
</div>
6977
</template>
@@ -80,7 +88,13 @@
8088
activeClient: null,
8189
activeServer: null,
8290
activeFramework: null,
83-
activeTab: null
91+
activeTab: null,
92+
clientContentUrl: null,
93+
serverContentUrl: null,
94+
clientContentLoading: true,
95+
serverContentLoading: true,
96+
clientContent: "",
97+
serverContent: ""
8498
}
8599
},
86100
created: function () {
@@ -109,6 +123,7 @@
109123
})
110124
this.activeFramework = defaultServerFramework.name
111125
}
126+
112127
},
113128
computed: {
114129
activeServerFrameworks: function () {
@@ -128,7 +143,7 @@
128143
},
129144
watch: {
130145
activeClient: function () {
131-
this.loadContent()
146+
this.loadClientContent()
132147
window.location.hash = '/'+this.activeClient+'/'+this.activeServer+'/'+this.activeFramework
133148
},
134149
activeServer: function () {
@@ -165,11 +180,11 @@
165180
166181
this.activeFramework = frameworkToSet
167182
168-
this.loadContent()
183+
this.loadServerContent()
169184
window.location.hash = '/'+this.activeClient+'/'+this.activeServer+'/'+this.activeFramework
170185
},
171186
activeFramework: function () {
172-
this.loadContent()
187+
this.loadServerContent()
173188
window.location.hash = '/'+this.activeClient+'/'+this.activeServer+'/'+this.activeFramework
174189
}
175190
},
@@ -190,28 +205,30 @@
190205
window.scrollTo(0, document.querySelectorAll(element)[0].offsetTop - 150)
191206
},
192207
193-
loadContent: function () {
208+
loadClientContent: function () {
209+
this.clientContentLoading = true
210+
211+
this.clientContentUrl = '/quickstart-fragments/' + this.activeClient + '/default-example/'
212+
213+
214+
document.getElementById('clientContentIframe').onload = () => {
215+
this.clientContentLoading = false
216+
this.clientContent = document.getElementById('clientContentIframe').contentDocument.querySelector('.PageContent-main').innerHTML
217+
}
218+
},
219+
220+
loadServerContent: function () {
221+
this.serverContentLoading = true
194222
let client = this.$themeConfig.quickstarts.clients.filter((client) => {
195223
return client.name === this.activeClient
196224
})[0];
197-
let clientContentUrl = '/quickstart-fragments/' + this.activeClient + '/default-example/'
198-
let serverContentUrl = '/quickstart-fragments/' + this.activeServer + '/' + this.activeFramework + '-' + client.serverExampleType
199225
200-
fetch(clientContentUrl)
201-
.then( response => {
202-
if( response.ok ) {
203-
return response.text();
204-
}
205-
// Here's where you can handle error status codes
206-
})
207-
.then( text => {
208-
const element = document.createElement('div')
209-
element.innerHTML = text
210-
console.log(element.getElementById('app'))
211-
})
212-
.catch( err => {
213-
// Here's where you handle network errors
214-
});
226+
this.serverContentUrl = '/quickstart-fragments/' + this.activeServer + '/' + this.activeFramework + '-' + client.serverExampleType + '/'
227+
228+
document.getElementById('serverContentIframe').onload = () => {
229+
this.serverContentLoading = false
230+
this.serverContent = document.getElementById('serverContentIframe').contentDocument.querySelector('.PageContent-main').innerHTML
231+
}
215232
}
216233
}
217234
}

0 commit comments

Comments
 (0)