aboutsummaryrefslogtreecommitdiff
path: root/src/views/About.vue
blob: ab4725e4cb8c85114e7f43668434aee8247cca24 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
<template>
  <div class="about">
    <router-link to="/editor">Create new database</router-link>
    <file-upload
      :accept="'application/json'"
      @file-changed="handleDatabaseChange">Use existing database</file-upload>
  </div>
</template>

<script>
import FileUpload from '../components/FileUpload.vue';

import { parsePtDatabase } from '../features/parser';

export default {
  name: 'About',
  components: {
    FileUpload,
  },
  methods: {
    handleDatabaseChange(files) {
      parsePtDatabase(files[0]).then((result) => {
        this.$store.commit('setLabs', result.labs);
        this.$store.commit('setPeerTeachers', result.peerTeachers);
        this.$router.push({ name: 'Editor' });
      });
    },
  },
};
</script>