Refactor main host setup
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
import type { PagePropsType } from "@/src/types";
|
||||
import type { BunextPageServerFn } from "@moduletrace/bunext/types";
|
||||
|
||||
const server: BunextPageServerFn<PagePropsType> = async (ctx) => {
|
||||
const props = ctx.props as PagePropsType;
|
||||
|
||||
if (!props.main_host?.name) {
|
||||
return {
|
||||
redirect: {
|
||||
destination: `/admin/hosts/add`,
|
||||
permanent: false,
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
return {
|
||||
props: {},
|
||||
};
|
||||
};
|
||||
|
||||
export default server;
|
||||
Reference in New Issue
Block a user