refactor: 💡 allow passthrough in mirage for asciicast data (#108)

This commit is contained in:
Cameron Perera authored and GitHub committed 2023-03-07 16:41:33 -06:00
1 parent f878e3404e
commit ef55d71a55
2 files changed
+4 -18

No files matched your search

+1
View File
@@ -33,6 +33,7 @@ export default function (mirageConfig) {
function routes() {
initializeMockIPC(this, environmentConfig);
this.passthrough();
// make this `http://localhost:8080`, for example, if your API is on a different server
// this.urlPrefix = '';
// make this `/api`, for example, if your API is namespaced
@@ -2,24 +2,9 @@ import Route from '@ember/routing/route';
export default class ScopesScopeSessionRecordingsSessionRecordingChannelsByConnectionChannelRoute extends Route {
async model() {
// building ascii cast here to make player availabe until API is ready
const castConfig = {
version: 2,
width: 124,
height: 36,
timestamp: 1670352594,
env: { SHELL: '/bin/zsh', TERM: 'xterm-256color' },
};
const asciicast = `${JSON.stringify(castConfig)}
[2.676444, "o", "y"]
[2.788653, "o", "a"]
[2.868652, "o", "r"]
[3.001764, "o", "n"]
[3.167636, "o", " "]
[3.313668, "o", "t"]
[3.460527, "o", "e"]
[3.561983, "o", "s"]
[3.63678, "o", "t"]`;
const response = await fetch('/session.cast');
const asciicast = await response.text();
return {
scope_id: 'srcc_1234567890',
asciicast: asciicast,