diff --git a/src/api/ghost/ghost.api.spec.ts b/src/api/ghost/ghost.api.spec.ts index f40a8bb..4eb905b 100644 --- a/src/api/ghost/ghost.api.spec.ts +++ b/src/api/ghost/ghost.api.spec.ts @@ -17,8 +17,17 @@ describe('GhostApi', () => { const domain = 'ghosts'; describe('getByPage()', () => { const page = 1; - it('should return ghosts', async () => { - responseData = {name: 'name', address: 'address', point: 1, level: 1}; + it('should return ghosts', async () => { + responseData = { + name: 'Token Name1', + gene: 'token ID', + tokenId: 1, + userAddress: 'user1', + level: 1, + angelPoint: 10, + devilPoint: 20, + createdDate: Date.now(), + }; mockAdapter.onGet(`/${domain}?page=${page}`).reply(200, responseData); expect(await ghostApi.getByPage(page)).toEqual(responseData); diff --git a/src/api/user/user.api.spec.ts b/src/api/user/user.api.spec.ts index dc75f48..a1da859 100644 --- a/src/api/user/user.api.spec.ts +++ b/src/api/user/user.api.spec.ts @@ -5,7 +5,7 @@ import {UserApi} from '@/api/user/user.api'; import {AxiosSupplier} from '@/api/axios/axios.supplier'; import {HttpClient} from '@/api/axios/http.client'; -describe('UserApi', () => { +describe('UserApi', () => { const mockAdapter = new MockAdapter(axios); const mockAxiosSupplier = mock(AxiosSupplier); diff --git a/src/components/sections/MarketPlaceSection.vue b/src/components/sections/MarketPlaceSection.vue index a216b15..0b62906 100644 --- a/src/components/sections/MarketPlaceSection.vue +++ b/src/components/sections/MarketPlaceSection.vue @@ -30,6 +30,7 @@ import GhostTable from '@/components/tables/GhostTable.vue'; import {Inject} from "vue-typedi"; import tokens from "@/store/tokens"; import {UserModule} from "@/store/modules/user"; +import {GhostModule} from "@/store/modules/ghost"; @Component({ components: { GhostCard, GhostTable}, @@ -40,6 +41,9 @@ export default class MarketPlaceSection extends Vue { @Inject(tokens.USER_MODULE) public userModule!: UserModule; + @Inject(tokens.GHOST_MODULE) + public ghostModule!: GhostModule; + constructor() { super(); this.currentNum = 1; diff --git a/src/store/index.ts b/src/store/index.ts index 5129e7d..a0760a8 100644 --- a/src/store/index.ts +++ b/src/store/index.ts @@ -1,7 +1,7 @@ import Vue from 'vue'; import Vuex from 'vuex'; -import { createVuexStore } from 'vuex-simple'; +import {createVuexStore} from 'vuex-simple'; import {Store} from './store'; import {Container} from 'vue-typedi'; import tokens from './tokens'; @@ -12,6 +12,7 @@ Vue.use(Vuex); const instance = new Store(); Container.set(tokens.USER_MODULE, instance.userModule); +Container.set(tokens.GHOST_MODULE, instance.ghostModule); export const store = createVuexStore(instance, { strict: false, @@ -20,3 +21,8 @@ export const store = createVuexStore(instance, { }); +// todo: move to config +const initPage: number = 1; +// todo: handle error correctly +instance.ghostModule.getGhostsByPage(initPage).then().catch(); + diff --git a/src/store/tokens.ts b/src/store/tokens.ts index 9ecb612..04ac8e2 100644 --- a/src/store/tokens.ts +++ b/src/store/tokens.ts @@ -3,4 +3,5 @@ import {Token} from 'typedi'; export default { USER_MODULE: new Token(), + GHOST_MODULE: new Token(), };