diff --git a/src/App.vue b/src/App.vue
index 310f4e8..4c43837 100644
--- a/src/App.vue
+++ b/src/App.vue
@@ -31,75 +31,35 @@
diff --git a/src/components/ServiceEmiter.ts b/src/components/ServiceEmiter.ts
index ed78a0e..0c3981b 100644
--- a/src/components/ServiceEmiter.ts
+++ b/src/components/ServiceEmiter.ts
@@ -5,37 +5,37 @@ import LoadableBlock from './loadable/LoadableBlock.vue'
import LoadableInline from './loadable/LoadableInline.vue'
import SuccessLoadable from './loadable/SuccessLoadableBlock.vue'
-import { ServiceData } from '@/types/App'
-import * as Events from '@/types/Events'
+import { ErrorsModule, LayoutsModule, ServicesModule } from '@/store'
+import { Options, ServiceData } from '@/types/App'
@Component({ components: { LoadableBlock, LoadableInline, SuccessLoadable } })
export default class ServiceEmiter extends Vue {
- @Prop(Function)
- readonly emit!: (name: string, msg: any) => void
+ @Prop(Number)
+ readonly tileKey!: number
- emitError(err: string) {
- this.emit(Events.ErrorEvent, err)
+ addError(error: any) {
+ ErrorsModule.add(error.toString())
}
- saveOptions(options: object) {
- this.emit(Events.SaveOptionsEvent, options)
+ saveOptions(options: Options) {
+ LayoutsModule.setTileOptions(this.tileKey, options)
}
saveOption(key: string, value: any) {
- this.saveOptionCouple({ key, value })
+ LayoutsModule.setTileOption(this.tileKey, key, value)
}
- saveOptionCouple(couple: Events.Option) {
- this.emit(Events.SaveOptionEvent, couple)
+ saveOptionCouple({ key, value }: { key: string, value: any }) {
+ this.saveOption(key, value)
}
- saveService(service: ServiceData) {
- this.emit(Events.SaveServiceEvent, service)
+ saveService({ name, auth }: ServiceData) {
+ ServicesModule.set(LayoutsModule.getTile(this.tileKey).service, name, auth)
}
- catchEmit(req: AxiosPromise) {
+ catchError(req: AxiosPromise) {
return req.catch(err => {
- this.emitError(err)
+ this.addError(err)
throw err
})
}
diff --git a/src/components/ServiceHeader.vue b/src/components/ServiceHeader.vue
index c29cfc9..1d90c26 100644
--- a/src/components/ServiceHeader.vue
+++ b/src/components/ServiceHeader.vue
@@ -16,24 +16,25 @@