-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e4a4881
commit 5d1560b
Showing
1 changed file
with
65 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,82 @@ | ||
<template> | ||
<div class="assignments"> | ||
<h1>This is the assignments view</h1> | ||
<div class="announcements" v-if="!loading"> | ||
<h1 style="padding-bottom: 1rem">All Assignments</h1> | ||
<div | ||
class="announcementsContainer" | ||
v-for="item in assignments" | ||
:key="item.id" | ||
> | ||
<AssignmentCard :assignment="item" /> | ||
</div> | ||
</div> | ||
<div class="loading" v-else> | ||
<v-progress-circular | ||
:size="50" | ||
color="primary" | ||
indeterminate | ||
></v-progress-circular> | ||
</div> | ||
</template> | ||
|
||
<script> | ||
import axios from "axios"; | ||
import AssignmentCard from "../components/AssignmentCard.vue"; | ||
export default { | ||
name: "AssignmentsView", | ||
created() { | ||
components: { | ||
AssignmentCard, | ||
}, | ||
data() { | ||
return { | ||
announcements: [], | ||
loading: true, | ||
}; | ||
}, | ||
async created() { | ||
// console.log("Setting breadcrumbs from announcements"); | ||
this.$store.commit("SET_BREADCRUMBS", [ | ||
{ | ||
text: "Assignments", | ||
disabled: false, | ||
href: "assignments", | ||
href: "/assignments", | ||
// to: "/announcements", | ||
exact: true, | ||
}, | ||
]); | ||
try { | ||
const response = await axios.get( | ||
"https://canvasapi.toddr.org/api/assignments", | ||
{ | ||
auth: { | ||
username: this.$store.state.user.email, | ||
password: this.$store.state.user.password, | ||
}, | ||
} | ||
); | ||
console.log("Response: ", response.data.data); | ||
this.assignments = response.data.data; | ||
this.loading = false; | ||
} catch (error) { | ||
console.error(error); | ||
} | ||
}, | ||
}; | ||
</script> | ||
|
||
<style local> | ||
h1 { | ||
color: white; | ||
} | ||
.announcementsContainer { | ||
padding-bottom: 1rem; | ||
} | ||
.loading { | ||
margin: 0; | ||
position: absolute; | ||
top: 50%; | ||
left: 50%; | ||
transform: translate(-50%, -50%); | ||
} | ||
</style> |