2023-12-05 10:37:40 -03:00
|
|
|
<svelte:head>
|
|
|
|
<title>Transporte: Usuario</title>
|
|
|
|
</svelte:head>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
import 'bootstrap/dist/css/bootstrap.min.css'
|
|
|
|
import '@adminkit/core/dist/css/app.css'
|
|
|
|
import '@adminkit/core/dist/js/app.js'
|
|
|
|
import 'bootstrap-icons/font/bootstrap-icons.css'
|
|
|
|
import '../assets/colors.css'
|
|
|
|
import '../assets/custom.css'
|
|
|
|
import Navbar from './Navbar.svelte'
|
|
|
|
import Sidebar from './Sidebar.svelte'
|
|
|
|
import Footer from './Footer.svelte'
|
|
|
|
import Notifications from './Notifications.svelte'
|
2024-01-07 13:16:53 -03:00
|
|
|
import { getRoutes } from '$/routes/user.routes'
|
2023-12-05 10:37:40 -03:00
|
|
|
import { Router, Route, createHistory } from 'svelte-navigator'
|
|
|
|
import hashHistory from './hashHistory'
|
|
|
|
import { onMount } from 'svelte'
|
|
|
|
import { getInfoToken } from '$/services/login'
|
|
|
|
import { storeSession } from '$/stores/global'
|
2024-01-20 14:19:38 -03:00
|
|
|
import Toast from '$/components/Toast.svelte';
|
2023-12-05 10:37:40 -03:00
|
|
|
|
|
|
|
|
|
|
|
let triggerEvent = false;
|
2023-12-10 13:03:41 -03:00
|
|
|
// @ts-ignore
|
2023-12-05 10:37:40 -03:00
|
|
|
const history = createHistory(hashHistory())
|
2024-01-07 13:16:53 -03:00
|
|
|
let routes = []
|
|
|
|
|
|
|
|
getRoutes()
|
|
|
|
.then(data => routes = data)
|
|
|
|
.catch(error => alert(error))
|
2023-12-05 10:37:40 -03:00
|
|
|
|
|
|
|
onMount(() => {
|
|
|
|
triggerEvent && document.dispatchEvent(new Event('DOMContentLoaded'));
|
|
|
|
})
|
|
|
|
|
|
|
|
async function begin() {
|
|
|
|
try {
|
|
|
|
$storeSession = await getInfoToken()
|
|
|
|
} catch (error) {
|
|
|
|
alert(error.message || error)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
begin()
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<div class="wrapper">
|
|
|
|
<Router {history} primary={false}>
|
|
|
|
<Sidebar />
|
|
|
|
|
|
|
|
<div class="main">
|
|
|
|
<Navbar />
|
|
|
|
|
|
|
|
<main class="content">
|
|
|
|
<div class="container-fluid p-0">
|
|
|
|
|
2024-01-07 13:16:53 -03:00
|
|
|
{#each routes as r, index}
|
|
|
|
<Route path={r.path} >
|
2023-12-05 10:37:40 -03:00
|
|
|
<svelte:component this={r.component} />
|
|
|
|
</Route>
|
|
|
|
{/each}
|
|
|
|
|
|
|
|
</div>
|
|
|
|
</main>
|
|
|
|
|
|
|
|
<Footer />
|
|
|
|
</div>
|
|
|
|
</Router>
|
|
|
|
</div>
|
|
|
|
|
2024-01-20 14:19:38 -03:00
|
|
|
<Notifications />
|
|
|
|
<Toast />
|