url pocket in store
This commit is contained in:
@@ -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}'`,
|
||||
|
||||
@@ -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 }
|
||||
})
|
||||
@@ -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',
|
||||
});
|
||||
|
||||
@@ -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 () => {
|
||||
|
||||
@@ -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);
|
||||
});
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user