This repository has been archived by the owner on Sep 7, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Pavel Kokovin
committed
Apr 19, 2019
1 parent
4d8ec91
commit 6be24bf
Showing
7 changed files
with
146 additions
and
2 deletions.
There are no files selected for viewing
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,74 @@ | ||
<template> | ||
<div class="invite-wrapper"> | ||
<UiPageHeader :title="$t('title')"> | ||
<UiButton | ||
slot="right" | ||
v-text="$t('accept')" | ||
@click="accept(currentVendorId)" | ||
/> | ||
</UiPageHeader> | ||
|
||
<div class="content"> | ||
<IconDummy /> | ||
<span class="dummy-text"> | ||
{{ $t('dummy') }} | ||
</span> | ||
</div> | ||
</div> | ||
</template> | ||
|
||
<script type="ts"> | ||
import Vue from 'vue'; | ||
import { mapGetters, mapState, mapActions } from 'vuex'; | ||
import { UiButton, UiPageHeader } from '@protocol-one/ui-kit'; | ||
import IconDummy from '@/components/IconDummy.vue'; | ||
import i18n from './i18n'; | ||
export default Vue.extend({ | ||
i18n, | ||
components: { IconDummy, UiButton, UiPageHeader }, | ||
computed: { | ||
...mapState('Invite', ['hasAccepted']), | ||
currentVendorId() { | ||
return this.$route.params.vendorId; | ||
}, | ||
inviteId() { | ||
return this.$route.params.inviteId; | ||
}, | ||
}, | ||
mounted() { | ||
this.initState(this.inviteId); | ||
}, | ||
methods: { | ||
...mapActions('Invite', ['initState', 'accept']), | ||
}, | ||
watch: { | ||
hasAccepted(val) { | ||
console.error(val); | ||
}, | ||
}, | ||
}); | ||
</script> | ||
|
||
<style scoped lang="scss"> | ||
.invite-wrapper { | ||
min-height: 100vh; | ||
width: 100%; | ||
display: flex; | ||
flex-direction: column; | ||
} | ||
.content { | ||
flex-grow: 1; | ||
display: flex; | ||
justify-content: center; | ||
align-items: center; | ||
flex-direction: column; | ||
} | ||
.dummy-text { | ||
display: block; | ||
color: #b1b1b1; | ||
text-align: center; | ||
margin-top: 20px; | ||
} | ||
</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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
export default { | ||
messages: { | ||
de: { | ||
accept: 'Accept Invite', | ||
title: 'Invite module', | ||
dummy: 'Dummy for invite module', | ||
}, | ||
en: { | ||
accept: 'Accept Invite', | ||
title: 'Invite module', | ||
dummy: 'Dummy for invite module', | ||
}, | ||
ru: { | ||
accept: 'Принять приглашение', | ||
title: 'Модель инвайтинга', | ||
dummy: 'Заглушка для страницы принятия инвайта', | ||
}, | ||
}, | ||
} |
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,40 @@ | ||
import axios from 'axios'; | ||
import { GetterTree, ActionTree, MutationTree } from 'vuex'; | ||
import { State } from './types'; | ||
|
||
export default function HistoryStore(apiUrl: string) { | ||
const state: State = { | ||
hasAccepted: false, | ||
inviteId: null, | ||
}; | ||
const getters: GetterTree<State, any> = {}; | ||
const actions: ActionTree<State, any> = { | ||
async initState({ commit }, inviteId) { | ||
commit('inviteId', inviteId); | ||
}, | ||
async accept({ commit, state }, vendorId) { | ||
const resp = await axios | ||
.put(`${apiUrl}/vendors/${vendorId}/memberships/invites/${state.inviteId}`, { | ||
method: 'accept', | ||
}) | ||
.then(() => { | ||
commit('hasAccepted', true); | ||
}) | ||
.catch(e => e); | ||
|
||
console.error(resp); | ||
}, | ||
}; | ||
const mutations: MutationTree<State> = { | ||
hasAccepted: (state, value) => state.hasAccepted = value, | ||
inviteId: (state, value) => state.inviteId = value, | ||
}; | ||
|
||
return { | ||
state, | ||
getters, | ||
actions, | ||
mutations, | ||
namespaced: true, | ||
}; | ||
} |
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,4 @@ | ||
export interface State { | ||
hasAccepted: boolean; | ||
inviteId: number; | ||
} |
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