Commit 174f91d8 authored by Khalid Ali's avatar Khalid Ali
Browse files

Add form to page

parent 3ee05698
Pipeline #3770 passed with stages
in 2 minutes and 53 seconds
This diff is collapsed.
......@@ -30,7 +30,7 @@ export default class BeerList extends Vue {
public beers: Beer[] = [];
private async created() {
const response = await axios.get('http://localhost:8080/good-beers');
const response = await axios.get('http://localhost:9090/good-beers');
this.beers = await response.data;
}
}
......
......@@ -27,5 +27,13 @@ export default new Router({
title: 'SRCT Bookshare - About',
},
},
{
path: '/create_listing',
name: 'create_listing',
component: () => import ('./views/CreateListing.vue'),
meta: {
title: 'SRCT Bookshare - Create Listing',
},
},
],
});
<template>
<form class="form" method="post" @submit.prevent="postNow">
ISBN<input class="textinput textInput form-control" id="id_isbn" maxlength="20" v-model="isbn" placeholder="0801884039" type="text" />
Title<input class="textinput textInput form-control" id="id_title" maxlength="200" v-model="title" placeholder="Squirrels: The Animal Answer Guide" type="text" />
Course<input class="textinput textInput form-control" id="id_course_abbr" maxlength="10" v-model="course_abbr" placeholder="ENGH 302" type="text" />
Condition<select class="select form-control" id="id_condition" v-model="condition">
<option value="New">New</option>
<option value="Like New">Like New</option>
<option value="Very Good">Very Good</option>
<option value="Good" selected="selected">Good</option>
<option value="Acceptable">Acceptable</option>
<option value="Unacceptable">Unacceptable</option>
</select>
Access Code<select class="select form-control" id="id_access_code" v-model="access_code">
<option value="Not Applicable" selected="selected">Not Applicable</option>
<option value="Access Code Included">Access Code Included</option>
<option value="Access Code NOT Included">Access Code NOT Included</option>
</select>
Price<input class="numberinput form-control" id="id_price" min="0" v-model="price" placeholder="whole numbers" type="number" value="0"/>
Other Notes<textarea class="textarea form-control" cols="40" id="id_description" maxlength="2000" v-model="description" placeholder="I would be willing to exchange this textbook for one that I need next semester. /// This is for Professor Smith&#39;s section ONLY. /// I can give you the workbook as well." rows="10"></textarea>
</form>
</template>
<script lang="ts">
import axios from 'axios';
import { Component, Vue } from 'vue-property-decorator';
@Component
export default class CreateListing extends Vue {
public errors: object[] = [];
private async postNow() {
axios.post('https://localhost:9090/bs/api/listing', {
isbn: this.$data.isbn,
title: this.$data.title,
course: this.$data.course,
}).catch(e => {
this.errors.push(e);
});
}
}
</script>
......@@ -3,7 +3,7 @@ module.exports = {
port: 8081,
proxy: {
'/good-beers': {
target: 'http://localhost:8080',
target: 'http://localhost:9090',
secure: false
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment