UPDATE: Logo y versión (#2)
This commit is contained in:
parent
1ceb542c61
commit
70b6fe99a0
2
public/images/.gitignore
vendored
2
public/images/.gitignore
vendored
@ -1,2 +0,0 @@
|
||||
*
|
||||
!.gitignore
|
||||
11
src/auth.js
11
src/auth.js
@ -8,7 +8,7 @@ import { i18n, lang } from '@/lang/i18n.js';
|
||||
import router from '@Router/Auth'
|
||||
import Notify from '@Plugins/Notify'
|
||||
import TailwindScreen from '@Plugins/TailwindScreen'
|
||||
import { pagePlugin } from '@Services/Page';
|
||||
import { defineApp, pagePlugin, reloadApp } from '@Services/Page';
|
||||
|
||||
import Auth from '@Holos/Layout/Auth.vue'
|
||||
|
||||
@ -22,16 +22,21 @@ window.TwScreen = new TailwindScreen();
|
||||
|
||||
async function boot() {
|
||||
try {
|
||||
const { data } = await axios.get(import.meta.env.VITE_API_URL + '/api/routes');
|
||||
const routes = await axios.get(import.meta.env.VITE_API_URL + '/api/resources/routes');
|
||||
const app = await axios.get(import.meta.env.VITE_API_URL + '/api/resources/app');
|
||||
|
||||
// Iniciar rutas
|
||||
window.Ziggy = data;
|
||||
window.Ziggy = routes.data;
|
||||
window.route = useRoute();
|
||||
|
||||
defineApp(app.data);
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
alert('Failed to load routes');
|
||||
}
|
||||
|
||||
reloadApp();
|
||||
|
||||
createApp(Auth)
|
||||
.use(createPinia())
|
||||
.use(i18n)
|
||||
|
||||
@ -1,7 +1,6 @@
|
||||
<script setup>
|
||||
import { onBeforeMount, onMounted } from 'vue';
|
||||
import { bootPermissions } from '@Plugins/RolePermission.js';
|
||||
import { reloadApp } from '@Services/Page';
|
||||
import useDarkMode from '@Stores/DarkMode'
|
||||
import useLeftSidebar from '@Stores/LeftSidebar'
|
||||
import useNotificationSidebar from '@Stores/NotificationSidebar'
|
||||
@ -23,7 +22,6 @@ defineProps({
|
||||
/** Ciclos */
|
||||
onBeforeMount(() => {
|
||||
bootPermissions()
|
||||
reloadApp();
|
||||
})
|
||||
|
||||
onMounted(()=> {
|
||||
|
||||
@ -59,7 +59,7 @@ onMounted(() => {
|
||||
</div>
|
||||
<div>
|
||||
<span>
|
||||
Versión {{ APP_VERSION }}
|
||||
APP {{ APP_VERSION }} API {{ $page.app.version }}
|
||||
</span>
|
||||
</div>
|
||||
</footer>
|
||||
|
||||
@ -13,6 +13,6 @@ const home = () => router.push(view({ name: 'index' }));
|
||||
class="flex w-full justify-center items-center space-x-2 cursor-pointer"
|
||||
@click="home"
|
||||
>
|
||||
<img src="/images/logo.png" class="h-20" />
|
||||
<img :src="$page.app.logo" class="h-20" />
|
||||
</div>
|
||||
</template>
|
||||
@ -45,7 +45,7 @@ const year = (new Date).getFullYear();
|
||||
© {{year}} {{ APP_COPYRIGHT }}
|
||||
</p>
|
||||
<p class="text-center text-xs text-yellow-500 cursor-pointer">
|
||||
V{{ APP_VERSION }}
|
||||
APP {{ APP_VERSION }} API {{ $page.app.version }}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -9,9 +9,9 @@ import router from '@Router/Index'
|
||||
import Notify from '@Plugins/Notify'
|
||||
import TailwindScreen from '@Plugins/TailwindScreen'
|
||||
import { pagePlugin } from '@Services/Page';
|
||||
import { reloadApp,view } from '@Services/Page';
|
||||
|
||||
import App from '@Layouts/AppLayout.vue'
|
||||
import { view } from '@Services/Page';
|
||||
|
||||
// Configurar axios
|
||||
axios.defaults.headers.common['X-Requested-With'] = 'XMLHttpRequest';
|
||||
@ -24,10 +24,10 @@ window.TwScreen = new TailwindScreen();
|
||||
|
||||
async function boot() {
|
||||
try {
|
||||
const { data } = await axios.get(import.meta.env.VITE_API_URL + '/api/routes');
|
||||
const routes = await axios.get(import.meta.env.VITE_API_URL + '/api/resources/routes');
|
||||
|
||||
// Iniciar rutas
|
||||
window.Ziggy = data;
|
||||
window.Ziggy = routes.data;
|
||||
window.route = useRoute();
|
||||
window.view = view;
|
||||
} catch (error) {
|
||||
@ -39,6 +39,8 @@ async function boot() {
|
||||
await import('@Services/Broadcast')
|
||||
}
|
||||
|
||||
reloadApp();
|
||||
|
||||
createApp(App)
|
||||
.use(createPinia())
|
||||
.use(i18n)
|
||||
|
||||
@ -36,7 +36,6 @@ onMounted(() => {
|
||||
|
||||
api.get(apiTo('roles', { user: props.userId }), {
|
||||
onSuccess: (r) => {
|
||||
console.log(r);
|
||||
form.roles = r.roles
|
||||
}
|
||||
});
|
||||
|
||||
@ -41,8 +41,6 @@ watch(twoFactorEnabled, () => {
|
||||
const enableTwoFactorAuthentication = () => {
|
||||
enabling.value = true;
|
||||
|
||||
console.log('enabling ...');
|
||||
|
||||
api.post(route('two-factor.enable'), {
|
||||
onSuccess: () => Promise.all([
|
||||
showQrCode(),
|
||||
|
||||
@ -22,7 +22,6 @@ const updatePassword = () => {
|
||||
Notify.success(Lang('account.password.updated'));
|
||||
},
|
||||
onError: (e) => {
|
||||
console.log(e);
|
||||
if (form.errors.password) {
|
||||
form.reset('password', 'password_confirmation');
|
||||
passwordInput.value.focus();
|
||||
|
||||
@ -10,6 +10,7 @@ import { resetPermissions } from '@Plugins/RolePermission';
|
||||
*/
|
||||
const page = reactive({
|
||||
lang: 'es',
|
||||
app: {},
|
||||
user: {
|
||||
id: 0,
|
||||
name: 'public'
|
||||
@ -21,10 +22,15 @@ const page = reactive({
|
||||
*/
|
||||
const reloadApp = () => {
|
||||
const user = localStorage.user
|
||||
const app = localStorage.app
|
||||
|
||||
if(user) {
|
||||
page.user = JSON.parse(user);
|
||||
}
|
||||
|
||||
if(app) {
|
||||
page.app = JSON.parse(app);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -62,6 +68,13 @@ const defineUser = (user) => {
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Definir datos de la aplicación
|
||||
*/
|
||||
const defineApp = (app) => {
|
||||
localStorage.app = JSON.stringify(app);
|
||||
}
|
||||
|
||||
/**
|
||||
* Instalar el componente de forma nativa
|
||||
*/
|
||||
@ -76,8 +89,6 @@ const pagePlugin = {
|
||||
* Reload user
|
||||
*/
|
||||
const reloadUser = () => {
|
||||
console.log('reloadUser')
|
||||
|
||||
return api.get(route('user.show'), {
|
||||
onSuccess: (r) => {
|
||||
defineUser(r.user)
|
||||
@ -107,10 +118,11 @@ const logout = () => {
|
||||
export {
|
||||
pagePlugin,
|
||||
page,
|
||||
defineApp,
|
||||
defineUser,
|
||||
reloadApp,
|
||||
reloadUser,
|
||||
resetPage,
|
||||
defineUser,
|
||||
logout,
|
||||
view
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user