Skip to content
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
68 lines (65 sloc) 2.16 KB
<div class="col-md-12 form-wrapper">
<h2> Create Post </h2>
<form id="create-post-form" @submit.prevent="createPost">
<div class="form-group col-md-12">
<label for="title"> Title </label>
<input type="text" id="title" v-model="title" name="title" class="form-control" placeholder="Enter title">
<div class="form-group col-md-12">
<label for="description"> Description </label>
<input type="text" id="description" v-model="description" name="description" class="form-control" placeholder="Enter Description">
<div class="form-group col-md-12">
<label for="body"> Write Content </label>
<textarea id="body" cols="30" rows="5" v-model="body" class="form-control"></textarea>
<div class="form-group col-md-12">
<label for="author"> Author </label>
<input type="text" id="author" v-model="author" name="author" class="form-control">
<div class="form-group col-md-4 pull-right">
<button class="btn btn-success" type="submit"> Create Post </button>
import axios from "axios";
import { server } from "../../utils/helper";
import router from "../../router";
export default {
data() {
return {
title: "",
description: "",
body: "",
author: "Olususi Oluyemi",
date_posted: ""
created() {
this.date_posted = new Date().toLocaleDateString();
methods: {
createPost() {
let postData = {
title: this.title,
description: this.description,
body: this.body,
date_posted: this.date_posted
__submitToServer(data) {`${server.baseURL}/blog/post`, data).then(data => {
router.push({ name: "home" });
You can’t perform that action at this time.