fulinqingjie/public/output/server/chunks/build/index-LDAB2eRI.mjs

57 lines
2.0 KiB
JavaScript

import { defineComponent, withAsyncContext, computed, useSSRContext } from 'vue';
import { ssrRenderAttrs } from 'vue/server-renderer';
import { u as useRequest } from './useRequest-pSRZvR3u.mjs';
import { u as useAsyncData } from './asyncData-D5wEK86T.mjs';
import { n as navigateTo } from './server.mjs';
import 'perfect-debounce';
import '../nitro/nitro.mjs';
import 'node:http';
import 'node:https';
import 'node:events';
import 'node:buffer';
import 'node:fs';
import 'node:path';
import 'node:crypto';
import 'node:url';
import '../routes/renderer.mjs';
import 'vue-bundle-renderer/runtime';
import 'unhead/server';
import 'devalue';
import 'unhead/plugins';
import 'unhead/utils';
import 'vue-router';
import 'axios';
const _sfc_main = /* @__PURE__ */ defineComponent({
__name: "index",
__ssrInlineRender: true,
async setup(__props) {
let __temp, __restore;
const request = useRequest();
const { data: tabsRes } = ([__temp, __restore] = withAsyncContext(async () => useAsyncData(
"business-tabs-first",
async () => await request.get("/api/project_cates")
)), __temp = await __temp, __restore(), __temp);
const firstId = computed(() => {
const res = tabsRes.value;
if (!res || res.code !== 200 || !Array.isArray(res.data) || res.data.length === 0) return "";
return String(res.data[0]?.id ?? "");
});
if (firstId.value) {
[__temp, __restore] = withAsyncContext(() => navigateTo(`/business/${firstId.value}`, { redirectCode: 302 })), await __temp, __restore();
}
return (_ctx, _push, _parent, _attrs) => {
_push(`<div${ssrRenderAttrs(_attrs)}></div>`);
};
}
});
const _sfc_setup = _sfc_main.setup;
_sfc_main.setup = (props, ctx) => {
const ssrContext = useSSRContext();
(ssrContext.modules || (ssrContext.modules = /* @__PURE__ */ new Set())).add("pages/business/index.vue");
return _sfc_setup ? _sfc_setup(props, ctx) : void 0;
};
export { _sfc_main as default };
//# sourceMappingURL=index-LDAB2eRI.mjs.map