mirror of
https://github.com/geoffsee/open-gsio.git
synced 2025-09-08 22:56:46 +00:00
adds eslint
This commit is contained in:

committed by
Geoff Seemueller

parent
9698fc6f3b
commit
02c3253343
@@ -1,24 +1,20 @@
|
||||
import { types } from "mobx-state-tree";
|
||||
import renderPage from "@open-gsio/client/server";
|
||||
import renderPage from '@open-gsio/client/server';
|
||||
import { types } from 'mobx-state-tree';
|
||||
|
||||
export default types
|
||||
.model("StaticAssetStore", {})
|
||||
.volatile((self) => ({
|
||||
.model('StaticAssetStore', {})
|
||||
.volatile(self => ({
|
||||
env: {} as Env,
|
||||
ctx: {} as ExecutionContext,
|
||||
}))
|
||||
.actions((self) => ({
|
||||
.actions(self => ({
|
||||
setEnv(env: Env) {
|
||||
self.env = env;
|
||||
},
|
||||
setCtx(ctx: ExecutionContext) {
|
||||
self.ctx = ctx;
|
||||
},
|
||||
async handleSsr(
|
||||
url: string,
|
||||
headers: Headers,
|
||||
env: Vike.PageContext.env,
|
||||
) {
|
||||
async handleSsr(url: string, headers: Headers, env: Vike.PageContext.env) {
|
||||
const pageContextInit = {
|
||||
urlOriginal: url,
|
||||
headersOriginal: headers,
|
||||
@@ -29,7 +25,6 @@ export default types
|
||||
const pageContext = await renderPage(pageContextInit);
|
||||
const { httpResponse } = pageContext;
|
||||
|
||||
|
||||
if (!httpResponse) {
|
||||
return null;
|
||||
} else {
|
||||
@@ -41,8 +36,8 @@ export default types
|
||||
try {
|
||||
return await env.ASSETS.fetch(request);
|
||||
} catch (error) {
|
||||
console.error("Error serving static asset:", error);
|
||||
return new Response("Asset not found", { status: 404 });
|
||||
console.error('Error serving static asset:', error);
|
||||
return new Response('Asset not found', { status: 404 });
|
||||
}
|
||||
},
|
||||
}));
|
||||
|
Reference in New Issue
Block a user