Просмотр исходного кода

Rename require with request

pull/2/head
Kristijan Mitrovic 4 лет назад
Родитель
Сommit
24e71d9038
3 измененных файлов: 22 добавлений и 19 удалений
  1. +2
    -2
      src/_services/user.service.js
  2. +12
    -12
      src/_store/account.module.js
  3. +8
    -5
      src/account/profile/PolicyPage.vue

+ 2
- 2
src/_services/user.service.js Просмотреть файл

@@ -12,7 +12,7 @@ export const userService = {
register,
searchAccounts,
getMe,
requireAccountDownload,
requestAccountDownload,
downloadAccount,
getUserById,
getPolicyByUserId,
@@ -93,7 +93,7 @@ function getMe(messages, errors) {
).then(util.handleCrudResponse(messages, errors));
}

function requireAccountDownload(messages, errors) {
function requestAccountDownload(messages, errors) {
return fetch(`${config.apiUrl}/me/download`, util.postWithAuth()).then(util.handlePlaintextResponse(messages, errors));
}



+ 12
- 12
src/_store/account.module.js Просмотреть файл

@@ -20,7 +20,7 @@ const defaultStatus = {
sendingVerification: false,
sendingResetPasswordMessage: false,
registrationError: null,
requiringAccountDownloadRequestSent: false,
requestAccountDownloadRequestSent: false,
downloadingAccount: false
};

@@ -182,11 +182,11 @@ const actions = {
error => commit('resendVerificationCodeFailure', error)
);
},
requireAccountDownload({ commit }, {messages, errors}) {
commit('requiringAccountDownloadRequest');
userService.requireAccountDownload(messages, errors)
.then(ok => commit('requiringAccountDownloadSuccess'),
error => commit('requiringAccountDownloadFailure', error));
requestAccountDownload({ commit }, {messages, errors}) {
commit('requestAccountDownloadRequest');
userService.requestAccountDownload(messages, errors)
.then(ok => commit('requestAccountDownloadSuccess'),
error => commit('requestAccountDownloadFailure', error));
},
downloadAccount({ commit }, {token, messages, errors}) {
commit('downloadAccountRequest');
@@ -383,18 +383,18 @@ const mutations = {
state.actionStatus = { error: error, type: 'verify' };
},

requiringAccountDownloadRequest(state) {
requestAccountDownloadRequest(state) {
state.status = Object.assign({}, state.status,
{ downloadingAccount: false, requiringAccountDownloadRequestSent: false });
{ downloadingAccount: false, requestAccountDownloadRequestSent: false });
state.actionStatus = { requesting: true, type: 'requestDownload' };
},
requiringAccountDownloadSuccess(state) {
state.status = Object.assign({}, state.status, { requiringAccountDownloadRequestSent: true });
requestAccountDownloadSuccess(state) {
state.status = Object.assign({}, state.status, { requestAccountDownloadRequestSent: true });
state.actionStatus = { success: true, type: 'requestDownload' };
},
requiringAccountDownloadFailure(state, error) {
requestAccountDownloadFailure(state, error) {
state.actionStatus = { error: error, type: 'requestDownload' };
console.log('requiringAccountDownloadFailure: ' + JSON.stringify(error));
console.log('requestAccountDownloadFailure: ' + JSON.stringify(error));
},

downloadAccountRequest(state) {


+ 8
- 5
src/account/profile/PolicyPage.vue Просмотреть файл

@@ -22,14 +22,17 @@
<hr/>
<div class="form-group">
<label htmlFor="downloadAccountBtn">{{messages.field_label_account_download}}</label>
<button class="btn btn-primary" name="downloadAccountBtn" :disabled="actionStatus.requesting" v-on:click="clickRequireAccountDownload()">{{messages.button_label_account_download}}</button>
<button class="btn btn-primary" name="downloadAccountBtn" :disabled="actionStatus.requesting"
v-on:click="clickRequestAccountDownload()">
{{ messages.button_label_account_download }}
</button>
<img v-show="loading()" src="data:image/gif;base64,R0lGODlhEAAQAPIAAP///wAAAMLCwkJCQgAAAGJiYoKCgpKSkiH/C05FVFNDQVBFMi4wAwEAAAAh/hpDcmVhdGVkIHdpdGggYWpheGxvYWQuaW5mbwAh+QQJCgAAACwAAAAAEAAQAAADMwi63P4wyklrE2MIOggZnAdOmGYJRbExwroUmcG2LmDEwnHQLVsYOd2mBzkYDAdKa+dIAAAh+QQJCgAAACwAAAAAEAAQAAADNAi63P5OjCEgG4QMu7DmikRxQlFUYDEZIGBMRVsaqHwctXXf7WEYB4Ag1xjihkMZsiUkKhIAIfkECQoAAAAsAAAAABAAEAAAAzYIujIjK8pByJDMlFYvBoVjHA70GU7xSUJhmKtwHPAKzLO9HMaoKwJZ7Rf8AYPDDzKpZBqfvwQAIfkECQoAAAAsAAAAABAAEAAAAzMIumIlK8oyhpHsnFZfhYumCYUhDAQxRIdhHBGqRoKw0R8DYlJd8z0fMDgsGo/IpHI5TAAAIfkECQoAAAAsAAAAABAAEAAAAzIIunInK0rnZBTwGPNMgQwmdsNgXGJUlIWEuR5oWUIpz8pAEAMe6TwfwyYsGo/IpFKSAAAh+QQJCgAAACwAAAAAEAAQAAADMwi6IMKQORfjdOe82p4wGccc4CEuQradylesojEMBgsUc2G7sDX3lQGBMLAJibufbSlKAAAh+QQJCgAAACwAAAAAEAAQAAADMgi63P7wCRHZnFVdmgHu2nFwlWCI3WGc3TSWhUFGxTAUkGCbtgENBMJAEJsxgMLWzpEAACH5BAkKAAAALAAAAAAQABAAAAMyCLrc/jDKSatlQtScKdceCAjDII7HcQ4EMTCpyrCuUBjCYRgHVtqlAiB1YhiCnlsRkAAAOwAAAAAAAAAAAA==" />
<div v-if="showDownloadMessages && !actionStatus.requesting">
<div v-if="actionStatus.type === 'requestDownload' && actionStatus.error"
class="invalid-feedback d-block alert alert-danger">
{{ actionStatus.error }}
</div>
<div v-if="status.requiringAccountDownloadRequestSent" class="alert alert-info">
<div v-if="status.requestAccountDownloadRequestSent" class="alert alert-info">
{{messages.field_label_account_download_requested_notice}}
</div>
</div>
@@ -454,7 +457,7 @@
methods: {
...mapActions('account', [
'approveAction', 'denyAction', 'sendAuthenticatorCode', 'resendVerificationCode',
'requireAccountDownload', 'downloadAccount'
'requestAccountDownload', 'downloadAccount'
]),
...mapActions('users', [
'getPolicyByUserId', 'updatePolicyByUserId', 'addPolicyContactByUserId', 'removePolicyContactByUserId'
@@ -549,10 +552,10 @@
errors: this.errors
});
},
clickRequireAccountDownload() {
clickRequestAccountDownload() {
this.errors.clear();
this.showDownloadMessages = true;
this.requireAccountDownload({ messages: this.messages, errors: this.errors });
this.requestAccountDownload({ messages: this.messages, errors: this.errors });
return false; // do not follow the click
},
startVerifyContact(contact) {


Загрузка…
Отмена
Сохранить