diff --git a/core/src/index.ts b/core/src/index.ts index 7fe4bd6..977d591 100644 --- a/core/src/index.ts +++ b/core/src/index.ts @@ -6,4 +6,5 @@ export * from './localization/index' export * from './util/index' export * from './animation/index' export * from './factory/index' -export * from './viewmodel/index' \ No newline at end of file +export * from './viewmodel/index' +export * from './service/index' \ No newline at end of file diff --git a/core/src/service/httpService.ts b/core/src/service/httpService.ts new file mode 100644 index 0000000..9c8f2d0 --- /dev/null +++ b/core/src/service/httpService.ts @@ -0,0 +1,3 @@ +export interface HttpService { + get: (route: string) => Promise; +} diff --git a/core/src/service/index.ts b/core/src/service/index.ts new file mode 100644 index 0000000..823f652 --- /dev/null +++ b/core/src/service/index.ts @@ -0,0 +1 @@ +export * from './httpService' \ No newline at end of file diff --git a/frontend/src/service/HttpService.ts b/frontend/src/service/HttpService.ts index c07c2f7..026638c 100644 --- a/frontend/src/service/HttpService.ts +++ b/frontend/src/service/HttpService.ts @@ -1,8 +1,4 @@ -import { server } from "../const/config"; - -export interface HttpService { - get: (route: string) => Promise; -} +import { HttpService } from "@mancala/core" export class HttpServiceImpl implements HttpService { public serverAdress: string; @@ -12,7 +8,7 @@ export class HttpServiceImpl implements HttpService { } public async get(route: string): Promise { - const url = server.serverAdress + route; + const url = this.serverAdress + route; const requestOptions = { method: 'GET', headers: { 'Content-Type': 'application/json' }, @@ -20,4 +16,4 @@ export class HttpServiceImpl implements HttpService { const response = await fetch(url, requestOptions); return response; } -} +} \ No newline at end of file diff --git a/mobile/src/service/HttpService.ts b/mobile/src/service/HttpService.ts index c07c2f7..026638c 100644 --- a/mobile/src/service/HttpService.ts +++ b/mobile/src/service/HttpService.ts @@ -1,8 +1,4 @@ -import { server } from "../const/config"; - -export interface HttpService { - get: (route: string) => Promise; -} +import { HttpService } from "@mancala/core" export class HttpServiceImpl implements HttpService { public serverAdress: string; @@ -12,7 +8,7 @@ export class HttpServiceImpl implements HttpService { } public async get(route: string): Promise { - const url = server.serverAdress + route; + const url = this.serverAdress + route; const requestOptions = { method: 'GET', headers: { 'Content-Type': 'application/json' }, @@ -20,4 +16,4 @@ export class HttpServiceImpl implements HttpService { const response = await fetch(url, requestOptions); return response; } -} +} \ No newline at end of file