mutations.js 737 Bytes
import * as Types from './types';

export default {
  [Types.FETCH_AUTHOR_INFO_REQUEST](state) {
    state.fetchAuthorInfo = true;
    state.authorBaseData = {};
  },
  [Types.FETCH_AUTHOR_INFO_FAILD](state) {
    state.authorBaseData = {};
    state.isOwner = false;
    state.fetchAuthorInfo = false;
  },
  [Types.FETCH_AUTHOR_INFO_SUCCESS](state, {data}) {
    data.isAttention = data.hasAttention === 'Y';
    state.authorBaseData = data;
    state.isOwner = +data.userType === 1;
    state.fetchAuthorInfo = true;
  },
  [Types.CHANGE_AUTHOR_OWNER_STATUS](state, isOwner) {
    state.isOwner = isOwner;
  },
  [Types.CHANGE_AUTHOR_ATTENTION_STATUS](state, isAttention) {
    state.authorBaseData.isAttention = isAttention;
  },
};