<template>
  <div class="container">
    <panel>
      <h1>Setup a password</h1>
      <text-field v-model="password" password />
      <btn primary label="Setup" @click="setup" />
    </panel>
  </div>
</template>

<script>
import Panel from "../components/Panel.vue";
import TextField from "../components/TextField.vue";
import Btn from "../components/Button.vue";
import axios from "axios";
export default {
  components: { Panel, TextField, Btn },
  data() {
    return {
      password: "",
    };
  },
  methods: {
    async setup() {
      await axios.post("/api/setup", { password: this.password });
      this.$router.push("/");
    },
  },
};
</script>
<style scoped>
.container {
  padding: 10px 50px;
  width: 500px;
  margin: 50px auto;
  color: #fff;
}
h1 {
  text-align: center;
  margin-bottom: 25px;
  font-weight: 300;
  font-size: 24px;
  text-transform: uppercase;
}
</style>
