File tree Expand file tree Collapse file tree 14 files changed +214
-19
lines changed
Expand file tree Collapse file tree 14 files changed +214
-19
lines changed Original file line number Diff line number Diff line change 2121 </a >
2222 </li >
2323 <li >
24- <a href =" /list " >
24+ <a href =" /lists " >
2525 <i class =" material-icons" >supervisor_account</i >
2626 </a >
2727 </li >
Original file line number Diff line number Diff line change 44 <h5 >Editando campanha</h5 >
55 </div >
66 <div class =" col s12" >
7- <a href =" '#/emails/view/' + email._id" class =" btn" >ver</a >
7+ <a : href =" '#/emails/view/' + email._id" class =" btn" >ver</a >
88 </div >
99 <div class =" col s12" >
1010 <div class =" card grey lighten-4" >
Original file line number Diff line number Diff line change 1+ <template >
2+ <div class =" row" >
3+ <div class =" col s12" >
4+ <h5 >Remoção de campanha</h5 >
5+ </div >
6+ <div class =" col s12" >
7+ <a :href =" '#/emails/view/' + email._id" class =" btn blue" >ver</a >
8+ </div >
9+ <div class =" col s12" >
10+ <div class =" card red white-text" >
11+ <div class =" card-content" >
12+ <span class =" card-title" >Confirmação</span >
13+ <p >Você confirma a remoção deste registro? Você não poderá desfazer essa operação</p >
14+ <a href =" " class =" btn white black-text" @click.prevent =" remove" >Sim</a >
15+ <a href =" #/email" class =" btn black" >Não</a >
16+ </div >
17+ </div >
18+ </div >
19+ </div >
20+ </template >
21+
22+ <script >
23+ export default {
24+ computed: {
25+ email : function () {
26+ return this .$store .state .email .email
27+ }
28+ },
29+ methods: {
30+ remove : function () {
31+ if (confirm (' Tem certeza?' )) {
32+ this .$store .dispatch (' remove' , this .email ._id ).then (() => {
33+ this .$router .push (' /email/' )
34+ })
35+ }
36+ }
37+ },
38+ mounted () {
39+ this .$store .dispatch (' getOne' , this .$route .params .id )
40+ }
41+ }
42+ </script >
Original file line number Diff line number Diff line change 11<template >
2- <div >
3- <h1 >Listas de disparo</h1 >
2+ <div class =" row" >
3+ <div class =" col s12" >
4+ <h5 >Lista de disparo</h5 >
5+ </div >
6+ <div class =" col s12" >
7+ <div class =" card" >
8+ <div class =" card-content" >
9+ <table >
10+ <thead >
11+ <tr >
12+ <th >#</th >
13+ <th >titulo</th >
14+ <th >quantidade</th >
15+ <th ></th >
16+ </tr >
17+ </thead >
18+ <tbody >
19+ <tr v-for =" (list, index) in lists" >
20+ <td >{{index + 1}}</td >
21+ <td >{{list.title}}</td >
22+ <td >{{list.quantity}}</td >
23+ <td >
24+ <a :href =" '#/lists/' + list._id" class =" btn" >ver</a >
25+ </td >
26+ </tr >
27+ </tbody >
28+ </table >
29+ </div >
30+ </div >
31+ </div >
432 </div >
533</template >
634<script >
735export default {
8-
36+ computed: {
37+ lists : function () {
38+ return this .$store .state .list .lists
39+ }
40+ },
41+ mounted : function () {
42+ this .$store .dispatch (' getAllList' )
43+ }
944}
1045 </script >
Original file line number Diff line number Diff line change @@ -8,6 +8,7 @@ import EmailList from '@/components/email/email-list'
88import EmailNew from '@/components/email/email-new'
99import EmailView from '@/components/email/email-view'
1010import EmailEdit from '@/components/email/email-edit'
11+ import EmailRemove from '@/components/email/email-remove'
1112import ListsList from '@/components/lists/lists-list'
1213
1314Vue . use ( Router )
@@ -44,6 +45,12 @@ let router = new Router({
4445 component : EmailEdit ,
4546 meta : { requiresAuth : true }
4647 } ,
48+ {
49+ path : '/emails/remove/:id' ,
50+ name : 'EmailRemove' ,
51+ component : EmailRemove ,
52+ meta : { requiresAuth : true }
53+ } ,
4754 {
4855 path : '/lists' ,
4956 name : 'ListsList' ,
Original file line number Diff line number Diff line change @@ -3,6 +3,7 @@ import Vuex from 'vuex'
33
44import user from './modules/user'
55import email from './modules/email'
6+ import list from './modules/list'
67
78window . axios = require ( 'axios' )
89window . axios . defaults . baseURL = process . env . SERVER
@@ -11,7 +12,8 @@ window.axios.defaults.headers.post['Content-Type'] = 'application/x-www-form-url
1112let config = {
1213 modules : {
1314 user : user ,
14- email : email
15+ email : email ,
16+ list : list
1517 }
1618}
1719
Original file line number Diff line number Diff line change @@ -32,10 +32,14 @@ export default {
3232 } )
3333 } ,
3434 update ( context , data ) {
35- console . log ( 'data' , data )
3635 return window . axios . put ( '/api/campaigns/' + data . _id , qs . stringify ( data ) ) . then ( ( response ) => {
3736 return response
3837 } )
38+ } ,
39+ remove ( context , id ) {
40+ return window . axios . delete ( '/api/campaigns/' + id ) . then ( ( response ) => {
41+ return response
42+ } )
3943 }
4044 }
4145}
Original file line number Diff line number Diff line change 1+ export default {
2+ state : {
3+ lists : [ ] ,
4+ list : { }
5+ } ,
6+ mutations : {
7+ updateLists ( state , data ) {
8+ state . lists = data
9+ } ,
10+ updateList ( state , data ) {
11+ state . list = data
12+ }
13+ } ,
14+ actions : {
15+ getAllList ( context ) {
16+ return window . axios . get ( '/api/lists' ) . then ( ( response ) => {
17+ context . commit ( 'updateLists' , response . data . data )
18+ return response
19+ } )
20+ }
21+ }
22+ }
Original file line number Diff line number Diff line change @@ -6,6 +6,7 @@ const logger = require('morgan');
66const mongoose = require ( './src/db/connection' ) ;
77const cors = require ( 'cors' ) ;
88const routes = require ( './src/routes' ) ;
9+ const validator = require ( 'express-validator' ) ;
910
1011// let indexRouter = require('./routes/index');
1112// let usersRouter = require('./routes/users');
@@ -22,6 +23,8 @@ app.use(express.json());
2223app . use ( express . urlencoded ( { extended : false } ) ) ;
2324app . use ( cookieParser ( ) ) ;
2425app . use ( express . static ( path . join ( __dirname , 'public' ) ) ) ;
26+ app . use ( validator ( ) ) ;
27+
2528
2629// app.use('/', indexRouter);
2730// app.use('/users', usersRouter);
You can’t perform that action at this time.
0 commit comments