Skip to content

Instantly share code, notes, and snippets.

View duwaljyoti's full-sized avatar

Jyoti Duwal duwaljyoti

  • Kathmandu ,Nepal
  • 07:14 (UTC +05:45)
View GitHub Profile
import state from './state';
import actions from './actions';
import mutations from './mutations';
import noteActions from '../../note/store/actions';
Vue.use(Vuex);
const noteModule = {
state: {},
actions: noteActions,
Route::prefix('api')->group(function() {
Route::resource('notes', 'Api\NotesController'); // get all the notes of logged in user.
Route::put('/notes/{note}/toggleFavourite', 'Api\NotesController@toggleFavourite'); // toggle favourite state of note
Route::get('/users', 'Api\UsersController@index'); // gets all the users
Route::get('/users/{user}/notes', 'Api\UsersController@getNotesByUser'); // get notes of a particular user
Route::get('/users/{user}/getFavouriteNotesId', 'Api\NotesController@getFavouriteId'); // gets favourited notes of an user
});
import User from './components/User.vue';
const routes = [
{ path: '/', name: 'user', component: User },
{ path: '*', redirect: '/' },
];
export default routes;
import Vue from 'vue';
import Vuex from 'vuex';
import VueRouter from 'vue-router';
import routes from './routes'; // user routes
import store from './store'; // user store
Vue.use(VueRouter);
Vue.use(Vuex);
// injecting the user routes to the vue router instance.
<template>
<div>
<loading :loading="loading">
</loading>
<flash>
</flash>
<nav-bar>
</nav-bar>
<div id="notes-list">
<div id="list-header">
<template>
<div>
<!--loading component-->
<loading :loading="loading">
</loading>
<!--flash component-->
<flash>
</flash>
<!--navbar component-->
import state from './state'; // note's state
import actions from './actions'; //note's action
import mutations from './mutations'; // note's mutation
const store = new Vuex.Store({
state,
actions,
mutations,
});
const routes = [
{ path: '/', name: 'note', component: Note },
{ path: '/create', name: 'create', component: Create },
{ path: '*', redirect: '/' },
];
export default routes;
import routes from './routes'; // user routes
import store from './store/index'; // user store
// injecting note routes to the vue router instance.
const router = new VueRouter({
routes,
});
// injecting router and store instance to the newly created vue object.
const NoteApplication = new Vue({
@extends('layouts.newApp')
@section('script')
<script src="{{ mix('build/js/noteApp.js') }}"></script>
@endsection