Skip to content

Commit c905873

Browse files
committed
wip
1 parent e2689d8 commit c905873

File tree

6 files changed

+576
-606
lines changed

6 files changed

+576
-606
lines changed

public/js/app.js

Lines changed: 3 additions & 27 deletions
Large diffs are not rendered by default.

public/mix-manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"/js/app.js": "/js/app.js?id=fb395abee7cbea04c8d3",
2+
"/js/app.js": "/js/app.js?id=b9339fab8f947d1604f7",
33
"/css/app.css": "/css/app.css?id=f6e72470fbc69619658a",
44
"/favicon.ico": "/favicon.ico?id=f7a1a9d5196af323a9eb"
55
}

resources/js/store/actions.type.js

Lines changed: 0 additions & 6 deletions
This file was deleted.

resources/js/store/modules/post.js

Lines changed: 22 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
import Vue from 'vue';
2-
import { FETCH_POST, POST_DELETE, POST_EDIT, POST_EDIT_TAGS, POST_EDIT_TOPIC, POST_RESET_STATE } from '../actions.type';
3-
import { SET_POST, SET_TAGS, SET_TOPIC, RESET_STATE } from '../mutations.type';
42

53
const initialState = {
64
id: '',
@@ -23,18 +21,18 @@ const initialState = {
2321
const state = { ...initialState };
2422

2523
const actions = {
26-
async [FETCH_POST](context, id) {
24+
async fetchPost(context, id) {
2725
this.request()
2826
.get('/api/posts/' + id)
2927
.then((response) => {
30-
context.commit(SET_POST, response.data.post);
28+
context.commit('SET_POST', response.data.post);
3129
})
3230
.catch((errors) => {
3331
console.log(errors);
3432
});
3533
},
36-
// eslint-disable-next-line no-unused-vars
37-
[POST_EDIT]({ context, id, payload }) {
34+
35+
updatePost({ id, payload }) {
3836
this.request()
3937
.post('/api/posts/' + id, payload)
4038
.then((response) => {
@@ -44,14 +42,16 @@ const actions = {
4442
console.log(errors);
4543
});
4644
},
47-
[POST_EDIT_TAGS]({ context, tags }) {
48-
context.commit(SET_TAGS, tags);
45+
46+
setTags({ context, tags }) {
47+
context.commit('SET_TAGS', tags);
4948
},
50-
[POST_EDIT_TOPIC]({ context, topic }) {
51-
context.commit(SET_TOPIC, topic);
49+
50+
setTopic({ context, topic }) {
51+
context.commit('SET_TOPIC', topic);
5252
},
53-
// eslint-disable-next-line no-unused-vars
54-
[POST_DELETE]({ context, id }) {
53+
54+
deletePost({ id }) {
5555
this.request()
5656
.delete('/api/posts/' + id, id)
5757
.then((response) => {
@@ -61,22 +61,26 @@ const actions = {
6161
console.log(errors);
6262
});
6363
},
64-
[POST_RESET_STATE]({ commit }) {
65-
commit(RESET_STATE);
64+
65+
resetPost({ commit }) {
66+
commit('RESET_STATE');
6667
},
6768
};
6869

6970
const mutations = {
70-
[SET_POST](state, post) {
71+
SET_POST(state, post) {
7172
state = post;
7273
},
73-
[SET_TAGS](state, tags) {
74+
75+
SET_TAGS(state, tags) {
7476
state.tags = tags;
7577
},
76-
[SET_TOPIC](state, topic) {
78+
79+
SET_TOPIC(state, topic) {
7780
state.topic = topic;
7881
},
79-
[RESET_STATE]() {
82+
83+
RESET_STATE() {
8084
for (let f in state) {
8185
Vue.set(state, f, initialState[f]);
8286
}

resources/js/store/mutations.type.js

Lines changed: 0 additions & 4 deletions
This file was deleted.

0 commit comments

Comments
 (0)