fix fetchData to start off as loading

This commit is contained in:
Keviin Åberg Kultalahti 2021-05-17 13:24:09 +02:00
parent 6ccf2114b0
commit 2eeb689b86
1 changed files with 1 additions and 1 deletions

View File

@ -5,7 +5,7 @@ export default function (url) {
const store = writable({ status: "LOADING", data: {}, error: {} })
async function get() {
store.update(u => ({ ...u, status: "SUCCESS" }))
store.update(u => ({ ...u, status: "LOADING" }))
try {
const response = await api.get(url)
store.set({ data: await response.json(), status: "SUCCESS" })