I've got a new Laravel 11 project with Breeze and Vue/Inertia with TypeScript. I'm trying to find a way to set Inertia's progress bar color dynamically based on a prop on the User model, but it doesn't seem that the user exists at the time createInertiaApp is instantiated. Is there any kind of lifecycle hook that I can use to set this color within app.ts and, if not, where else can I set this so that I can be assured of having an authenticated user available?
If it helps, here's my app.ts:
import "./bootstrap";
import "../css/app.css";
import "@mdi/font/css/materialdesignicons.css";
import { createApp, h, DefineComponent } from "vue";
import { createInertiaApp } from "@inertiajs/vue3";
import { resolvePageComponent } from "laravel-vite-plugin/inertia-helpers";
import { ZiggyVue } from "../../vendor/tightenco/ziggy";
import { createPinia } from "pinia";
import "vuetify/styles";
import { createVuetify } from "vuetify";
import * as components from "vuetify/components";
import * as directives from "vuetify/directives";
import useTheme from "./Hooks/useTheme";
const vuetify = createVuetify({
components,
directives,
icons: {
defaultSet: "mdi",
},
theme: useTheme(),
});
const pinia = createPinia();
const appName = import.meta.env.VITE_APP_NAME || "Laravel";
createInertiaApp({
title: (title) => `${title} - ${appName}`,
resolve: (name) => resolvePageComponent(`./Pages/${name}.vue`, import.meta.glob<DefineComponent>("./Pages/**/*.vue")),
setup({ el, App, props, plugin }) {
createApp({ render: () => h(App, props) })
.use(plugin)
.use(ZiggyVue)
.use(vuetify)
.use(pinia)
.mount(el);
},
progress: {
color: "#FF0000", <-- MAKE DYNAMIC BASED ON USER VALUE
},
});