sidebar and dashboard added
This commit is contained in:
parent
7e944ac917
commit
9f6c30541e
|
|
@ -8,6 +8,6 @@
|
|||
</head>
|
||||
<body>
|
||||
<div id="app"></div>
|
||||
<script type="module" src="/src/main.ts"></script>
|
||||
<script type="module" src="/src/initApp.ts"></script>
|
||||
</body>
|
||||
</html>
|
||||
</html>
|
||||
|
Before Width: | Height: | Size: 50 KiB After Width: | Height: | Size: 50 KiB |
|
Before Width: | Height: | Size: 361 KiB After Width: | Height: | Size: 361 KiB |
|
|
@ -1,7 +1,7 @@
|
|||
export const authAPI = {
|
||||
csrfGenerate: "users/auth/csrf/",
|
||||
login: "users/auth/login/",
|
||||
refresh: "users/auth/refresh/",
|
||||
logout: "users/auth/logout/",
|
||||
// csrfGenerate: "users/auth/csrf/",
|
||||
login: "users/login/",
|
||||
refresh: "users/token/refresh/",
|
||||
// logout: "users/auth/logout/",
|
||||
self: "users/self/",
|
||||
};
|
||||
|
|
|
|||
27
src/initApp.ts
Normal file
27
src/initApp.ts
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
async function loadConfig() {
|
||||
try {
|
||||
const response = await fetch("/config.json");
|
||||
if (!response.ok) throw new Error("Configuration Missing");
|
||||
window.APP_CONFIG = await response.json();
|
||||
document.title = window.APP_CONFIG.CLIENT_PAGE_TITLE;
|
||||
|
||||
const link = document.createElement("link");
|
||||
link.rel = "icon";
|
||||
link.type = "image/png";
|
||||
link.href = "/dartachalani" + window.APP_CONFIG.CLIENT_PAGE_TITLE_LOGO;
|
||||
|
||||
const existingIcons = document.querySelectorAll('link[rel*="icon"]');
|
||||
existingIcons.forEach((el: any) => el.parentNode.removeChild(el));
|
||||
|
||||
document.head.appendChild(link);
|
||||
} catch (e) {
|
||||
alert("Configuration Missing");
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
(async () => {
|
||||
await loadConfig();
|
||||
const { initAPP } = await import("./main");
|
||||
initAPP();
|
||||
})();
|
||||
|
|
@ -38,3 +38,4 @@ export const initAPP = () => {
|
|||
|
||||
app.mount("#app");
|
||||
};
|
||||
// initAPP();
|
||||
|
|
@ -2,6 +2,14 @@ import type { RouteRecordRaw } from "vue-router";
|
|||
// import { PERMISSIONS } from "@/constants/permissions";
|
||||
|
||||
const authChildren: Array<RouteRecordRaw> = [
|
||||
{
|
||||
path: "/",
|
||||
name: "dashboard",
|
||||
component: () => import("@/views/Dashboard/Components/Dashboard.vue"),
|
||||
meta: {
|
||||
permission: "",
|
||||
},
|
||||
},
|
||||
];
|
||||
|
||||
export default authChildren;
|
||||
|
|
|
|||
|
|
@ -3,10 +3,10 @@ import { authAPI } from "@/core/endpoints/auth";
|
|||
import { getCSRFTokenFromCookie } from "./utilities";
|
||||
import { useUser } from "@/stores/User/User";
|
||||
|
||||
const apiURL: string = window.APP_CONFIG.API_URL;
|
||||
// const apiURL: string = window.APP_CONFIG.API_URL;
|
||||
|
||||
const api = axios.create({
|
||||
baseURL: apiURL,
|
||||
baseURL: "http://localhost:8000/api/v3/",
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
},
|
||||
|
|
@ -50,7 +50,7 @@ api.interceptors.response.use(
|
|||
originalRequest.headers["X-CSRFToken"] = csrfToken;
|
||||
}
|
||||
try {
|
||||
await axios.post(apiURL + authAPI.refresh, null, {
|
||||
await axios.post("http://localhost:8000/api/v3/" + authAPI.refresh, null, {
|
||||
withCredentials: true,
|
||||
headers: {
|
||||
"X-CSRFToken": csrfToken,
|
||||
|
|
|
|||
|
|
@ -17,8 +17,8 @@ export const useUser = defineStore("user", {
|
|||
actions: {
|
||||
async fetchUserDetail() {
|
||||
try {
|
||||
const response = await api.get(authAPI.self);
|
||||
this.user = response.data.data;
|
||||
// const response = await api.get(authAPI.self);
|
||||
// this.user = response.data.data;
|
||||
this.isAuthenticated = true;
|
||||
} catch (error: any) {
|
||||
if (error.response.status == 403) {
|
||||
|
|
|
|||
|
|
@ -1,13 +1,38 @@
|
|||
import type { RouteRecordRaw } from "vue-router";
|
||||
const authChildren: Array<RouteRecordRaw> = [
|
||||
{
|
||||
path: "/",
|
||||
name: "dashboard",
|
||||
component: () => import("@/views/Dashboard/Components/Dashboard.vue"),
|
||||
meta: {
|
||||
permission: "",
|
||||
},
|
||||
},
|
||||
]
|
||||
import type { SidebarItem } from "@/dtos/common/Sidebar";
|
||||
|
||||
export default authChildren;
|
||||
export function useSidebarItems(): SidebarItem[] {
|
||||
return [
|
||||
{
|
||||
label: "Dashboard",
|
||||
isVisible: true,
|
||||
},
|
||||
{
|
||||
label: "Dashboard",
|
||||
icon: "Home",
|
||||
isVisible: true,
|
||||
to: "/",
|
||||
},
|
||||
{
|
||||
label: "DartaChalani",
|
||||
isVisible: true,
|
||||
},
|
||||
{
|
||||
label: "Darta",
|
||||
icon: "FileInput",
|
||||
isVisible: true,
|
||||
to: "/darta",
|
||||
},
|
||||
{
|
||||
label: "Chalani",
|
||||
icon: "FileOutput",
|
||||
isVisible: true,
|
||||
to: "/chalani",
|
||||
},
|
||||
{
|
||||
label: "Tippani",
|
||||
icon: "FilePenLine",
|
||||
isVisible: true,
|
||||
to: "/tippani",
|
||||
},
|
||||
];
|
||||
}
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@
|
|||
|
||||
<script setup lang="ts">
|
||||
// import api from "@/services/API/api";
|
||||
import { ref, onMounted } from "vue";
|
||||
import { ref } from "vue";
|
||||
// import VChart from "vue-echarts";
|
||||
|
||||
// import { use } from "echarts/core";
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user