Skip to content

Commit

Permalink
Front-end for import-parsed view
Browse files Browse the repository at this point in the history
  • Loading branch information
ShishckovA committed Jul 14, 2023
1 parent e3067e5 commit f15ba9d
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions front-end/src/components/Apanel/ImportSchedule.vue
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@

<script>
import { patchError } from "@/utils/message";
import { parseSchedulePost } from "@/api/import-schedule";
import { parseSchedulePost, saveParsedPost } from "@/api/import-schedule";
import { Message } from "element-ui";
export default {
name: "ImportScheduleComponent",
Expand Down Expand Up @@ -67,6 +68,12 @@ export default {
this.$refs.attachmentUpload.value = null;
this.$refs.attachmentUpload.click();
},
messageImportedLessons(number) {
Message({
message: `Успешно добавлено ${number} занятий.`,
type: "success",
});
},
onAttachmentPicked() {
const formData = new FormData();
if (this.$refs.attachmentUpload.files[0]) {
Expand All @@ -82,7 +89,12 @@ export default {
}
},
onSaveParsed() {
return 0;
const requestData = JSON.parse(this.$data.parsedSchedule);
if (requestData) {
saveParsedPost(requestData).then(response => {
this.messageImportedLessons(response.data.created);
});
}
},
},
};
Expand Down

0 comments on commit f15ba9d

Please sign in to comment.