136 lines
3.5 KiB
TypeScript
136 lines
3.5 KiB
TypeScript
import { createApp } from 'vue';
|
|
import App from './App.vue';
|
|
import VueDatePicker from '@vuepic/vue-datepicker';
|
|
import '@vuepic/vue-datepicker/dist/main.css';
|
|
import ConfirmationModal from '@/components/ConfirmationModal.vue';
|
|
import NavBar from '@/components/NavBar.vue';
|
|
import MainForm from '@/components/MainForm.vue';
|
|
import OrdersSelector from '@/components/OrdersSelector.vue'
|
|
import ConfirmedForm from '@/components/ConfirmedForm.vue'
|
|
import LoadingComponent from '@/components/LoadingComponent.vue'
|
|
import axios from 'axios'
|
|
import LoginModal from '@/components/LoginModal.vue'
|
|
import { createPinia, storeToRefs } from 'pinia'
|
|
import VueCookies from 'vue3-cookies'
|
|
import { router } from '@/router/router'
|
|
import { useSiteControlStore } from '@/stores/siteControl.store'
|
|
import { useCategoriesStore } from '@/stores/categories.store'
|
|
import { useOrdersStore } from '@/stores/orders.store'
|
|
import { useContractorsStore } from '@/stores/contractors.store'
|
|
import { useUserStore } from '@/stores/user.store'
|
|
|
|
const app = createApp(App);
|
|
const pinia = createPinia();
|
|
app.use(pinia);
|
|
app.use(VueCookies);
|
|
app.use(router);
|
|
useOrdersStore();
|
|
useContractorsStore();
|
|
useCategoriesStore();
|
|
useSiteControlStore();
|
|
|
|
|
|
export const axiosInstance = axios.create({
|
|
baseURL: 'https://zamowienia.mleczarnia-kuzma.pl/api',
|
|
withCredentials: true
|
|
});
|
|
|
|
axiosInstance.interceptors.response.use( (response) => {
|
|
return response;
|
|
}, (error) => {
|
|
if (error.response.status == 401) {
|
|
const userStore = useUserStore();
|
|
storeToRefs(userStore).username.value = undefined;
|
|
router.push('/login');
|
|
}
|
|
});
|
|
|
|
app.component('VueDatePicker', VueDatePicker);
|
|
app.component('ConfirmationModal', ConfirmationModal);
|
|
app.component('LoginModal', LoginModal);
|
|
app.component('NavBar', NavBar);
|
|
app.component('MainForm', MainForm);
|
|
app.component('OrdersSelector', OrdersSelector);
|
|
app.component('ConfirmedForm', ConfirmedForm);
|
|
app.component('LoadingComponent', LoadingComponent);
|
|
app.mount('#app');
|
|
|
|
export interface Category {
|
|
GIDNumer: number,
|
|
GrONumer: number,
|
|
Kod: string,
|
|
Nazwa: string,
|
|
Poziom: number,
|
|
Sciezka: string,
|
|
Towary: Array<Product>
|
|
isVisible: boolean
|
|
}
|
|
|
|
export interface Product {
|
|
Twr_Cena: string,
|
|
Twr_CenaZ: string,
|
|
Twr_JM: string,
|
|
Twr_JMPrzelicznikL: string,
|
|
Twr_JMPrzelicznikM: string,
|
|
Twr_JMZ: string,
|
|
Twr_Kod: string,
|
|
Twr_Nazwa: string,
|
|
Twr_NieAktywny: number,
|
|
Twr_Stawka: string,
|
|
Twr_TwGGIDNumer: number,
|
|
Twr_TwrId: number,
|
|
Options: Array<string>,
|
|
ChosenOption: string,
|
|
Quantity: number
|
|
}
|
|
|
|
export interface Contractor {
|
|
Knt_Email: string,
|
|
Knt_KntId: number,
|
|
Knt_KodPocztowy: string,
|
|
Knt_Miasto: string,
|
|
Knt_Nazwa1: string,
|
|
Knt_Nazwa2: string,
|
|
Knt_Nazwa3: string,
|
|
Knt_Nieaktywny: number,
|
|
Knt_NipE: string,
|
|
Knt_NrDomu: string,
|
|
Knt_OpiekunId: number,
|
|
Knt_OpiekunTyp: number,
|
|
Knt_Ulica: string,
|
|
Knt_Wojewodztwo: string
|
|
}
|
|
|
|
export interface Order {
|
|
MZN_Bufor: number,
|
|
MZN_DataDos: string,
|
|
MZN_DataZam: string,
|
|
MZN_MZNID: number,
|
|
MZN_OpeID: number,
|
|
MZN_PodID: number,
|
|
MZN_PodKodPocztowy: string,
|
|
MZN_PodMiasto: string,
|
|
MZN_PodNazwa1: string,
|
|
MZN_PodNazwa2: string,
|
|
MZN_PodNazwa3: string,
|
|
MZN_PodNipE: string,
|
|
MZN_PodNrDomu: string,
|
|
MZN_PodUlica: string,
|
|
MZN_PodWojewodztwo: string,
|
|
MZN_TypDokumentu: number,
|
|
MZN_UUID: string,
|
|
MZamElem: Array<OrderProduct>
|
|
}
|
|
|
|
export interface OrderProduct {
|
|
MZE_MZEID: number | undefined,
|
|
MZE_MZNID: number | undefined,
|
|
MZE_TwrCena: string,
|
|
MZE_TwrId: number,
|
|
MZE_TwrIlosc: string,
|
|
MZE_TwrJm: string,
|
|
MZE_TwrNazwa: string,
|
|
MZE_TwrStawka: string | undefined
|
|
}
|
|
|