diff options
author | Victor Chabbert <chabbertvi@eisti.eu> | 2017-07-31 18:44:01 +0200 |
---|---|---|
committer | Victor Chabbert <chabbertvi@eisti.eu> | 2017-08-07 22:41:20 +0200 |
commit | be86c9d23cdae888598e1f7de7812d7e0f1ca12c (patch) | |
tree | f39e95e3e8781c336b6221ce91c557d9e7e84fb0 /frontend/src/api | |
parent | Updrade react router and react router redux (diff) | |
download | seven-wonders-be86c9d23cdae888598e1f7de7812d7e0f1ca12c.tar.gz seven-wonders-be86c9d23cdae888598e1f7de7812d7e0f1ca12c.tar.bz2 seven-wonders-be86c9d23cdae888598e1f7de7812d7e0f1ca12c.zip |
Refactor routes to new structure
Diffstat (limited to 'frontend/src/api')
-rw-r--r-- | frontend/src/api/model.js | 98 | ||||
-rw-r--r-- | frontend/src/api/sevenWondersApi.js | 8 |
2 files changed, 56 insertions, 50 deletions
diff --git a/frontend/src/api/model.js b/frontend/src/api/model.js index 2f9fad37..5d1f92c6 100644 --- a/frontend/src/api/model.js +++ b/frontend/src/api/model.js @@ -1,79 +1,79 @@ // @flow export type ApiError = { - message: string; - details: ApiErrorDetail[]; -} + message: string, + details: ApiErrorDetail[] +}; export type ApiErrorDetail = { - message: string; -} + message: string +}; export type ApiGameState = "LOBBY" | "PLAYING"; export type ApiLobby = { - id: number; - name: string; - owner: ApiPlayer; - players: ApiPlayer[]; - settings: ApiSettings; - state: ApiGameState; -} + id: number, + name: string, + owner: ApiPlayer, + players: ApiPlayer[], + settings: ApiSettings, + state: ApiGameState +}; export type ApiWonderSidePickMethod = "EACH_RANDOM" | "ALL_A" | "ALL_B" | "SAME_RANDOM_FOR_ALL"; export type ApiSettings = { - randomSeedForTests: number; - timeLimitInSeconds: number; - wonderSidePickMethod: ApiWonderSidePickMethod; - initialGold: number; - discardedCardGold: number; - defaultTradingCost: number; - pointsPer3Gold: number; - lostPointsPerDefeat: number; - wonPointsPerVictoryPerAge: Map<number, number>; -} + randomSeedForTests: number, + timeLimitInSeconds: number, + wonderSidePickMethod: ApiWonderSidePickMethod, + initialGold: number, + discardedCardGold: number, + defaultTradingCost: number, + pointsPer3Gold: number, + lostPointsPerDefeat: number, + wonPointsPerVictoryPerAge: Map<number, number> +}; export type ApiPlayer = { - username: string; - displayName: string; - index: number; - ready: boolean; -} + username: string, + displayName: string, + index: number, + ready: boolean +}; -export type ApiTable = {} +export type ApiTable = {}; -export type ApiAction = {} +export type ApiAction = {}; -export type ApiHandCard = {} +export type ApiHandCard = {}; -export type ApiCard = {} +export type ApiCard = {}; -export type ApiPreparedCard = {} +export type ApiPreparedCard = {}; export type ApiPlayerTurnInfo = { - playerIndex: number; - table: ApiTable; - currentAge: number; - action: ApiAction; - hand: ApiHandCard[]; - neighbourGuildCards: ApiCard[]; - message: string; -} + playerIndex: number, + table: ApiTable, + currentAge: number, + action: ApiAction, + hand: ApiHandCard[], + neighbourGuildCards: ApiCard[], + message: string +}; export type ApiMoveType = "PLAY" | "PLAY_FREE" | "UPGRADE_WONDER" | "DISCARD" | "COPY_GUILD"; export type ApiProvider = "LEFT_NEIGHBOUR" | "RIGHT_NEIGHBOUR"; export type ApiResourceType = "WOOD" | "STONE" | "ORE" | "CLAY" | "GLASS" | "PAPYRUS" | "LOOM"; export type ApiResources = { - quantities: Map<ApiResourceType, number>; -} + quantities: Map<ApiResourceType, number> +}; export type ApiBoughtResources = { - provider: ApiProvider; - resources: ApiResources; -} + provider: ApiProvider, + resources: ApiResources +}; export type ApiPlayerMove = { - type: ApiMoveType; - cardName: string; - boughtResources: ApiBoughtResources[]; -} + type: ApiMoveType, + cardName: string, + boughtResources: ApiBoughtResources[] +}; diff --git a/frontend/src/api/sevenWondersApi.js b/frontend/src/api/sevenWondersApi.js index 058408eb..534045c8 100644 --- a/frontend/src/api/sevenWondersApi.js +++ b/frontend/src/api/sevenWondersApi.js @@ -1,6 +1,12 @@ // @flow import type { - ApiError, ApiLobby, ApiPlayer, ApiPlayerMove, ApiPlayerTurnInfo, ApiPreparedCard, ApiTable, + ApiError, + ApiLobby, + ApiPlayer, + ApiPlayerMove, + ApiPlayerTurnInfo, + ApiPreparedCard, + ApiTable, } from './model'; import type { JsonStompClient, SubscribeFn } from './websocket'; import { createJsonStompClient } from './websocket'; |