1
1
mirror of https://github.com/aelve/guide.git synced 2024-12-25 05:43:32 +03:00
guide/front/client/mixins/conflictDialogMixin.ts
avele 469b5b5790
Front/structure refactor and building reconfigure (#277)
* DefferedPromise refactor

* Moved defferedPromise to utils folder

* Base url moved to app file

* Store modules states rewrittten according to vue doc recommendations

* Deffered promise usage moved

* removed unused packages in entries

* Structure refactor, easier building, prod building configured, tsconfig reconfigure removed useless packages

* Update front/index.html

Co-Authored-By: avele <34437766+avele@users.noreply.github.com>

* Update front/postcss.config.js

Co-Authored-By: avele <34437766+avele@users.noreply.github.com>

* Comment rewritten
2019-04-18 01:52:43 +04:00

36 lines
913 B
TypeScript

import Vue from 'vue'
import { Mixin } from 'vue-mixin-decorator'
import ConflictDialog from 'client/components/ConflictDialog.vue'
import DeferredPromise from 'utils/DeferredPromise'
const ComponentClass = Vue.extend(ConflictDialog)
interface IConflictDialogProps {
serverModified: string,
modified: string,
merged: string
}
@Mixin
export default class ConflictDialogMixin extends Vue {
async openConflictDialog ({ serverModified, modified, merged }: IConflictDialogProps): Promise<string> {
const instance = new ComponentClass({
propsData: {
value: true,
serverModified,
modified,
merged
}
})
instance.$mount()
const deferredPromise = new DeferredPromise()
this.$el.appendChild(instance.$el)
instance.$on('save', (newVal) => {
instance.$destroy()
deferredPromise.resolve(newVal)
})
return deferredPromise
}
}