Skip to content

Commit

Permalink
api service now saves homework in localStorage
Browse files Browse the repository at this point in the history
  • Loading branch information
TheBlackbird14 committed May 26, 2024
1 parent 84f920c commit 4b92f56
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/components/homeworkList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ function onDelete(id: number, array: number) {
<div
v-if="!dataIsHere && !old_dataisHere"
class="d-flex justify-content-center align-items-center"
style="height: 8vh"
style="height: 100vh"
>
<div class="spinner-border spinner" role="status">
<span class="visually-hidden">Loading...</span>
Expand Down
4 changes: 4 additions & 0 deletions src/scripts/api.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,10 @@ class ApiService {
homeworks.push(newHomework)
})

const homework_string = JSON.stringify(homeworks)

localStorage.setItem('homework', homework_string)

return homeworks
} catch (e) {
console.error('Error fetching data: ', e)
Expand Down

0 comments on commit 4b92f56

Please sign in to comment.