Some changes
This commit is contained in:
@@ -3,6 +3,8 @@ import { Form, Field } from 'vee-validate';
|
||||
import * as Yup from 'yup';
|
||||
import { axiosInstance } from '@/main'
|
||||
import { router } from '@/router/router'
|
||||
import { useUserStore } from '@/stores/user.store'
|
||||
import { storeToRefs } from 'pinia'
|
||||
|
||||
const schema = Yup.object().shape({
|
||||
username: Yup.string().required('Nazwa użytkownika jest wymagana'),
|
||||
@@ -25,6 +27,8 @@ async function onSubmit(values : any, { setErrors } : any) {
|
||||
}
|
||||
});
|
||||
if(body != undefined && body.status == 200) {
|
||||
const userStore = useUserStore();
|
||||
localStorage.setItem("username", username);
|
||||
await router.push('/');
|
||||
}
|
||||
|
||||
|
||||
@@ -24,22 +24,28 @@ import { storeToRefs } from 'pinia'
|
||||
import { useCategoriesStore } from '@/stores/categories.store'
|
||||
import { useOrdersStore } from '@/stores/orders.store'
|
||||
import { useSiteControlStore } from '@/stores/siteControl.store'
|
||||
import { useUserStore } from '@/stores/user.store'
|
||||
|
||||
const contractorsStore = useContractorsStore();
|
||||
const categoriesStore = useCategoriesStore();
|
||||
const ordersStore = useOrdersStore();
|
||||
const siteControlStore = useSiteControlStore();
|
||||
const userStore = useUserStore();
|
||||
const contractors = storeToRefs(contractorsStore).contractors;
|
||||
const contractor = storeToRefs(contractorsStore).contractor;
|
||||
const categories = storeToRefs(categoriesStore).categories;
|
||||
|
||||
const { uuid, order } = storeToRefs(ordersStore);
|
||||
|
||||
const { username } = storeToRefs(userStore);
|
||||
const { isForm, isOrders, showConfirmationModal, isLoading } = storeToRefs(siteControlStore);
|
||||
|
||||
|
||||
async function fetchData() {
|
||||
await categoriesStore.fetchCategories();
|
||||
await contractorsStore.fetchContractors();
|
||||
const usernameString = localStorage.getItem("username");
|
||||
if(usernameString != null) {
|
||||
username.value = usernameString;
|
||||
}
|
||||
isLoading.value = false;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user