url pocket in store

This commit is contained in:
2024-09-07 12:30:31 +02:00
parent 0e302223e9
commit a2d44137cd
5 changed files with 10 additions and 5 deletions

View File

@@ -65,6 +65,10 @@
import { onMounted, ref } from 'vue'
import { useRoute } from 'vue-router'
import PocketBase from 'pocketbase';
import { useUserStore } from '@/stores/user'
// access the `store` variable anywhere in the component ✨
const storeUser = useUserStore()
const route = useRoute()
let id_lista = route.params.id
@@ -73,7 +77,7 @@ let pb = null
let nombreLista = ref('')
onMounted(async () => {
pb = new PocketBase('http://127.0.0.1:8090');
pb = new PocketBase(storeUser.urlPocketbase);
items.value = await pb.collection('item').getFullList( {
filter: `field.id = '${id_lista}'`,

View File

@@ -4,6 +4,7 @@ import { defineStore } from 'pinia'
export const useUserStore = defineStore('user', () => {
const user = ref()
const isValid = ref(false)
const urlPocketbase = "http://127.0.0.1:8090"
return { user, isValid }
return { user, isValid, urlPocketbase }
})

View File

@@ -43,7 +43,7 @@ let pb = ref()
let listas = ref()
onMounted(async () => {
pb = new PocketBase('http://127.0.0.1:8090');
pb = new PocketBase(storeUser.urlPocketbase);
listas.value = await pb.collection('listas').getFullList({
sort: '-created',
});

View File

@@ -142,7 +142,7 @@ const visibleModalSended = ref(false);
const visibleModalInvalid = ref(false);
onMounted(() => {
pb = new PocketBase("http://127.0.0.1:8090");
pb = new PocketBase(storeUser.urlPocketbase);
});
const login = async () => {

View File

@@ -89,7 +89,7 @@ let password = ref("");
let passwordRepeat = ref("");
onMounted(() => {
pb = new PocketBase("http://127.0.0.1:8090");
pb = new PocketBase(storeUser.urlPocketbase);
});