mpa/langs/currency
This commit is contained in:
129
stores/mapStore.ts
Normal file
129
stores/mapStore.ts
Normal file
@ -0,0 +1,129 @@
|
||||
import type { CountryList, PartnersList } from "~/types";
|
||||
|
||||
export const useMapStore = defineStore("mapStore", () => {
|
||||
const partnersList = ref<PartnersList[]>([
|
||||
{
|
||||
country_iso: "cz",
|
||||
total: 9,
|
||||
country_name: "Czech Republic",
|
||||
},
|
||||
{
|
||||
country_iso: "de",
|
||||
total: 1,
|
||||
country_name: "Germany",
|
||||
},
|
||||
{
|
||||
country_iso: "ie",
|
||||
total: 1,
|
||||
country_name: "Ireland",
|
||||
},
|
||||
{
|
||||
country_iso: "nl",
|
||||
total: 1,
|
||||
country_name: "Netherlands",
|
||||
},
|
||||
{
|
||||
country_iso: "pl",
|
||||
total: 61,
|
||||
country_name: "Poland",
|
||||
},
|
||||
]);
|
||||
|
||||
const customersList = ref([
|
||||
"be",
|
||||
"cz",
|
||||
"de",
|
||||
"dk",
|
||||
"gb",
|
||||
"ie",
|
||||
"it",
|
||||
"nl",
|
||||
"no",
|
||||
"pl",
|
||||
"sk",
|
||||
"at",
|
||||
"lt",
|
||||
"is",
|
||||
"se"
|
||||
]);
|
||||
|
||||
const countryList = ref<CountryList[]>()
|
||||
const countries = ref<CountryList[]>()
|
||||
|
||||
// async function getPartnersList() {
|
||||
// try {
|
||||
// const res = await fetch(
|
||||
// `http://127.0.0.1:4000/api/public/partners/count`,
|
||||
// {
|
||||
// headers: {
|
||||
// "Content-Type": "application/json",
|
||||
// },
|
||||
// }
|
||||
// );
|
||||
|
||||
// if (!res.ok) {
|
||||
// throw new Error(`HTTP error: ${res.status}`);
|
||||
// }
|
||||
|
||||
// const data = await res.json();
|
||||
// partnersList.value = data.data
|
||||
// } catch (error) {
|
||||
// console.error("getList error:", error);
|
||||
// }
|
||||
// }
|
||||
|
||||
// async function getCustomerList() {
|
||||
// try {
|
||||
// const res = await fetch(
|
||||
// `http://127.0.0.1:4000/api/public/customer/countries`,
|
||||
// {
|
||||
// headers: {
|
||||
// "Content-Type": "application/json",
|
||||
// },
|
||||
// }
|
||||
// );
|
||||
|
||||
// if (!res.ok) {
|
||||
// throw new Error(`HTTP error: ${res.status}`);
|
||||
// }
|
||||
|
||||
// const data = await res.json();
|
||||
// customersList.value = data.data
|
||||
// } catch (error) {
|
||||
// console.error("getList error:", error);
|
||||
// }
|
||||
// }
|
||||
|
||||
async function getCountries() {
|
||||
try {
|
||||
const res = await fetch(
|
||||
`http://127.0.0.1:4000/api/public/countries`,
|
||||
{
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
},
|
||||
}
|
||||
);
|
||||
|
||||
if (!res.ok) {
|
||||
throw new Error(`HTTP error: ${res.status}`);
|
||||
}
|
||||
|
||||
const data = await res.json();
|
||||
countries.value = data.ata
|
||||
} catch (error) {
|
||||
console.error("getList error:", error);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return {
|
||||
partnersList,
|
||||
customersList,
|
||||
// countryList,
|
||||
countries,
|
||||
// getPartnersList,
|
||||
// getCustomerList,
|
||||
getCountries
|
||||
};
|
||||
});
|
Reference in New Issue
Block a user