From 9cd264e8397a9ed7da760a6ffa1de65c42845e68 Mon Sep 17 00:00:00 2001 From: Arina Yakovenko Date: Mon, 16 Jun 2025 15:53:57 +0200 Subject: [PATCH] shop --- components/section/login-page/LoginMain.vue | 18 +- .../registration-page/RegistrationMain.vue | 93 ++++-- components/section/shop-page/Product.vue | 53 +++ components/section/shop-page/ShopMain.vue | 302 ++++++++++++++++++ stores/store.ts | 35 ++ 5 files changed, 470 insertions(+), 31 deletions(-) create mode 100644 components/section/shop-page/Product.vue create mode 100644 components/section/shop-page/ShopMain.vue diff --git a/components/section/login-page/LoginMain.vue b/components/section/login-page/LoginMain.vue index 9a944c7..f1d7f60 100644 --- a/components/section/login-page/LoginMain.vue +++ b/components/section/login-page/LoginMain.vue @@ -7,7 +7,7 @@ }" />
-
+

{{ $t('login') }}

{{ $t('email') }}

-

{{ $t('password') }}

-

{{ $t('forgot_password_question') - }}

+ }}

- {{ $t('login') }} + {{ $t('login') }}

{{ $t('no_account') - }}

+ }}

{{ $t('sign_up_now') - }}

+ }}

@@ -49,4 +49,6 @@ type Component = { section_id: string; section_img: string; section_lang_data: {}; -}; \ No newline at end of file +}; +const store = useStore() + \ No newline at end of file diff --git a/components/section/registration-page/RegistrationMain.vue b/components/section/registration-page/RegistrationMain.vue index 017338f..7edd626 100644 --- a/components/section/registration-page/RegistrationMain.vue +++ b/components/section/registration-page/RegistrationMain.vue @@ -1,5 +1,5 @@ \ No newline at end of file diff --git a/components/section/shop-page/Product.vue b/components/section/shop-page/Product.vue new file mode 100644 index 0000000..acd2545 --- /dev/null +++ b/components/section/shop-page/Product.vue @@ -0,0 +1,53 @@ + + + diff --git a/components/section/shop-page/ShopMain.vue b/components/section/shop-page/ShopMain.vue new file mode 100644 index 0000000..49e468a --- /dev/null +++ b/components/section/shop-page/ShopMain.vue @@ -0,0 +1,302 @@ + + + + \ No newline at end of file diff --git a/stores/store.ts b/stores/store.ts index 1f07948..b060b3e 100644 --- a/stores/store.ts +++ b/stores/store.ts @@ -13,6 +13,10 @@ export const useStore = defineStore("store", () => { const totalInvestment = ref() const minValue = ref() + // login + const email = ref() + const password = ref() + const components = ref({} as PBPageItem[]); const getSections = async (id: string) => { pb.cancelRequest("menu_view"); @@ -111,6 +115,34 @@ export const useStore = defineStore("store", () => { } } + async function logIn() { + try { + const res = await fetch( + 'http://127.0.0.1:4000/api/public/user/session/start', + { + method: 'POST', + body: JSON.stringify({ + mail: email.value, + password: password.value + }), + headers: { + "Content-Type": "application/json", + }, + } + ); + + if (!res.ok) { + throw new Error(`HTTP error: ${res.status}`); + } + + const data = await res.json(); + minValue.value = data.data + + } catch (error) { + console.error("getList error:", error); + } + } + getCalculator() getMinValue() @@ -121,6 +153,9 @@ export const useStore = defineStore("store", () => { monthlySavings, storagePeriod, minValue, + email, + password, + logIn, getCalculator, getComponents, getSections,