tethys.backend/config/inertia.ts
Arno Kaimbacher a29865b781
Some checks failed
CI Pipeline / japa-tests (push) Failing after 58s
- renamings to the new naming convetion for adonisjs version 6
- npm updates
2024-04-29 11:25:50 +02:00

69 lines
1.7 KiB
TypeScript

import { defineConfig } from '@adonisjs/inertia';
import type { HttpContext } from '@adonisjs/core/http';
export default defineConfig({
/**
* Path to the Edge view that will be used as the root view for Inertia responses
*/
rootView: 'app',
/**
* Data that should be shared with all rendered pages
*/
sharedData: {
//This will be available in all views
appName: 'Tethys Cloud',
errors: (ctx) => ctx.session?.flashMessages.get('errors'),
user_id: (ctx) => {
return ctx.session?.flashMessages.get('user_id');
},
flash: (ctx) => {
return {
message: ctx.session?.flashMessages.get('message'),
warning: ctx.session?.flashMessages.get('warning'),
};
},
// params: ({ params }) => params,
authUser: async ({ auth }: HttpContext) => {
if (auth?.user) {
await auth.user.load('roles');
return auth.user;
// {
// 'id': auth.user.id,
// 'login': auth.user.login,
// };
} else {
return null;
}
},
},
/**
* Options for the server-side rendering
*/
ssr: {
enabled: false,
entrypoint: 'inertia/app/ssr.ts',
},
});
// import { InertiaConfig } from '@ioc:EidelLev/Inertia';
// /*
// |--------------------------------------------------------------------------
// | Inertia-AdonisJS config
// |--------------------------------------------------------------------------
// |
// */
// export const inertia: InertiaConfig = {
// view: 'app',
// // ssr: {
// // enabled: false,
// // },
// };