-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add confirmation of registration (#85)
* Add User to vuex * Add confirmation of registration
- Loading branch information
1 parent
634aa99
commit 19bdf10
Showing
8 changed files
with
240 additions
and
99 deletions.
There are no files selected for viewing
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
<template> | ||
<div class="confirmation"> | ||
<b-row class="breadcrumbs" no-gutters> | ||
<b-col cols="12"> | ||
<b-breadcrumb :items="breadcrumbs" /> | ||
</b-col> | ||
</b-row> | ||
|
||
<b-row> | ||
<b-col cols="8" offset="2" align="center"> | ||
<h5 :class="status">{{ message }}</h5> | ||
|
||
<router-link :to="{ name: 'UserAuthorization' }" key="authorization" v-if="status === 'success'"> | ||
Войти | ||
<i class="fa fa-long-arrow-right align-middle" aria-hidden="true" /> | ||
</router-link> | ||
</b-col> | ||
</b-row> | ||
</div> | ||
</template> | ||
|
||
<script> | ||
export default { | ||
data() { | ||
return { | ||
breadcrumbs: [ | ||
{ | ||
text: 'Главная', | ||
href: this.$router.resolve({ name: 'Mainpage' }).href | ||
}, { | ||
text: 'Подтверждение емэйла', | ||
active: true | ||
} | ||
], | ||
message: '', | ||
status: 'failure' | ||
} | ||
}, | ||
created() { | ||
this.confirmEmail(this.$router.currentRoute.params.token) | ||
}, | ||
methods: { | ||
confirmEmail: function(token) { | ||
this.$http.post(this.$root.$options.settings.api.endpointEmailConfirmation(token)) | ||
.then(response => { | ||
this.status = 'success' | ||
this.message = response.data.data | ||
}) | ||
.catch(error => { | ||
this.status = 'failure' | ||
this.message = `Ошибка подтверждения: ${error.response.data.error.message.toLowerCase()}` | ||
}) | ||
} | ||
} | ||
} | ||
</script> | ||
|
||
<style lang="scss" scoped> | ||
@import '../../assets/scss/global'; | ||
.breadcrumbs { | ||
.breadcrumb { | ||
background-color: transparent; | ||
margin-top: 4%; | ||
padding-left: 0; | ||
padding-top: 0; | ||
.active { | ||
color: $color-gray-dark; | ||
} | ||
} | ||
} | ||
.failure { | ||
color: $color-red; | ||
} | ||
.success { | ||
color: $color-green; | ||
} | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,100 @@ | ||
export default { | ||
state: { | ||
api: { | ||
authorizationToken: '' | ||
}, | ||
counters: { | ||
totalEvents: 0 | ||
}, | ||
currentTileProvider: '', | ||
msk64Config: { | ||
configVersion: '' | ||
}, | ||
pgaConfig: { | ||
configVersion: '' | ||
}, | ||
plateBoundaries: [], | ||
srssCoreConfig: { | ||
dbVersion: '' | ||
} | ||
}, | ||
getters: { | ||
apiAuthorizationToken: state => { return state.api.authorizationToken }, | ||
currentTileProvider: state => { return state.currentTileProvider }, | ||
chartDataset: () => { | ||
return { | ||
datasets: [{ | ||
label: '', | ||
data: [], | ||
fill: true, | ||
lineTension: 0.1, | ||
backgroundColor: 'rgba(51,122,183,0.4)', | ||
borderColor: 'rgba(51,122,183,1)', | ||
borderCapStyle: 'butt', | ||
borderDash: [], | ||
borderDashOffset: 0.0, | ||
borderJoinStyle: 'miter', | ||
pointBorderColor: 'rgba(51,122,183,1)', | ||
pointBackgroundColor: 'rgba(51,122,183,1)', | ||
pointBorderWidth: 1, | ||
pointHoverRadius: 5, | ||
pointHoverBackgroundColor: 'rgba(51,122,183,1)', | ||
pointHoverBorderColor: 'rgba(51,122,183,1)', | ||
pointHoverBorderWidth: 2, | ||
pointRadius: 1, | ||
pointHitRadius: 10 | ||
}], | ||
labels: [] | ||
} | ||
}, | ||
msk64ConfigVersion: state => { return state.msk64Config.configVersion }, | ||
pgaConfigVersion: state => { return state.pgaConfig.configVersion }, | ||
plateBoundaries: state => { return state.plateBoundaries }, | ||
srssDBVersion: state => { return state.srssCoreConfig.dbVersion }, | ||
totalEventsCount: state => { return state.counters.totalEvents } | ||
}, | ||
mutations: { | ||
setCurrentTileProvider(state, { key, value }) { | ||
state[key] = value | ||
}, | ||
setPlateBoundaries(state, { key, value }) { | ||
state[key] = value | ||
}, | ||
setCounter(state, { key, value }) { | ||
state.counters[key] = value | ||
}, | ||
setMsk64Config(state, { key, value }) { | ||
state.msk64Config[key] = value | ||
}, | ||
setPgaConfig(state, { key, value }) { | ||
state.pgaConfig[key] = value | ||
}, | ||
setSrssDBVersion(state, { key, value }) { | ||
state.srssCoreConfig[key] = value | ||
} | ||
}, | ||
actions: { | ||
setCurrentTileProvider({ commit, state }, provider) { | ||
if (provider !== state.currentTileProvider) { | ||
commit('setCurrentTileProvider', { key: 'currentTileProvider', value: provider }) | ||
} | ||
}, | ||
setPlateBoundaries({ commit, state }, value) { | ||
if (value !== state.plateBoundaries) { | ||
commit('setPlateBoundaries', { key: 'plateBoundaries', value: value }) | ||
} | ||
}, | ||
setTotalEventsCount({ commit }, value) { | ||
commit('setCounter', { key: 'totalEvents', value: value }) | ||
}, | ||
setMsk64ConfigVersion({ commit }, value) { | ||
commit('setMsk64Config', { key: 'configVersion', value: value }) | ||
}, | ||
setPgaConfigVersion({ commit }, value) { | ||
commit('setPgaConfig', { key: 'configVersion', value: value }) | ||
}, | ||
setSrssDBVersion({ commit }, value) { | ||
commit('setSrssDBVersion', { key: 'dbVersion', value: value }) | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
export default { | ||
state: { | ||
authorized: false, | ||
token: null, | ||
refreshToken: null | ||
}, | ||
getters: { | ||
user: state => { | ||
return { | ||
authorized: state.authorized, | ||
token: state.token, | ||
refreshToken: state.refreshToken | ||
} | ||
} | ||
}, | ||
mutations: { | ||
setUser(state, { key, value }) { | ||
state[key] = value | ||
} | ||
}, | ||
actions: { | ||
setUserAuthorized({ commit, state }, value) { | ||
commit('setUser', { key: 'authorized', value: value }) | ||
}, | ||
setUserTokens({ commit, state }, value) { | ||
commit('setUser', { key: 'token', value: value.token }) | ||
commit('setUser', { key: 'refreshToken', value: value.refreshToken }) | ||
commit('setUser', { key: 'authorized', value: true }) | ||
} | ||
} | ||
} |