hey guys, if in my current .svelte file i have `...
# help
a
hey guys, if in my current .svelte file i have
Copy code
let 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
Copy code
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 ?
n
Hello @Ape R Us! This thread has been automatically created from your message in #843999948717555735 a ``few seconds ago``. Pinging @User so that they see this as well! Want to unsubscribe from this thread? Right-click the thread in Discord (or use the ... menu) and select Leave Thread to unsubscribe from future updates. Want to change the title? Use the
/title
command! We have solved your problem? Click the button below to archive it.
a
@User
o
Hi We already got the mention from the bot, you don't need to mention the support role again. Thanks you.
n
Ape R Us (2022-03-27)
o
Also, about your issue:
Copy code
ts
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