Ape R Us
03/27/2022, 11:02 PMlet todos = [];
onMount(async () => {
let { data, error } = await supabase .from('todos') .select('*')
todos = data;
however i don't think that's pretty efficient,
in my store.js file, should it be written as
export const todos = writable([])
export const loadTodos = async() => {
let { data, error } = await supabase
.from('todos')
.select('*')
todos = data;
}
Im not sure if that is even correct but, If so, how do i call it back into my .svelte file to load ?Needle
03/27/2022, 11:02 PM/title
command!
We have solved your problem?
Click the button below to archive it.Ape R Us
03/27/2022, 11:03 PMNeedle
03/27/2022, 11:04 PMOlyno
03/27/2022, 11:10 PMts
export const todos = writable([])
export const loadTodos = async() => {
let { data, error } = await supabase
.from('todos')
.select('*')
todos.set(data);
}
This would be what you're looking for, and yeah you can replace your current store with the ``loadTodos`` method @User