Compare commits
10 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
d72bf5d0fe
|
|||
|
f566f83398
|
|||
|
668551bc04
|
|||
|
79e95cecfa
|
|||
|
c82a7f0fa1
|
|||
| d635c9b0c0 | |||
| 96754c5999 | |||
| bcd1189f30 | |||
| 8730766c66 | |||
|
67c877385f
|
84
.drone.yml
84
.drone.yml
@@ -1,3 +1,4 @@
|
|||||||
|
---
|
||||||
kind: pipeline
|
kind: pipeline
|
||||||
type: docker
|
type: docker
|
||||||
name: frontend
|
name: frontend
|
||||||
@@ -23,14 +24,6 @@ steps:
|
|||||||
- cd frontend
|
- cd frontend
|
||||||
- yarn
|
- yarn
|
||||||
|
|
||||||
# - name: Run unit tests
|
|
||||||
# image: node
|
|
||||||
# environment:
|
|
||||||
# CI: true
|
|
||||||
# commands:
|
|
||||||
# - cd frontend
|
|
||||||
# - yarn test
|
|
||||||
|
|
||||||
- name: Build and push frontend image
|
- name: Build and push frontend image
|
||||||
image: plugins/docker
|
image: plugins/docker
|
||||||
settings:
|
settings:
|
||||||
@@ -61,9 +54,7 @@ steps:
|
|||||||
- frontend/node_modules
|
- frontend/node_modules
|
||||||
when:
|
when:
|
||||||
event: push
|
event: push
|
||||||
status:
|
status: [ success, failure ]
|
||||||
- success
|
|
||||||
- failure
|
|
||||||
|
|
||||||
- name: Flush cache
|
- name: Flush cache
|
||||||
image: plugins/s3-cache:1
|
image: plugins/s3-cache:1
|
||||||
@@ -79,15 +70,11 @@ steps:
|
|||||||
debug: true
|
debug: true
|
||||||
filename: frontend.tar
|
filename: frontend.tar
|
||||||
when:
|
when:
|
||||||
status:
|
status: [ success, failure ]
|
||||||
- success
|
|
||||||
- failure
|
|
||||||
|
|
||||||
trigger:
|
trigger:
|
||||||
branch:
|
event: [ tag, promote ]
|
||||||
- release/*
|
refs: [ refs/heads/release/*, refs/tags/* ]
|
||||||
ref:
|
|
||||||
- refs/tags/* # only trigger when tagging
|
|
||||||
|
|
||||||
---
|
---
|
||||||
kind: pipeline
|
kind: pipeline
|
||||||
@@ -116,14 +103,6 @@ steps:
|
|||||||
- ls -la
|
- ls -la
|
||||||
- yarn
|
- yarn
|
||||||
|
|
||||||
# - name: Run unit tests
|
|
||||||
# image: node
|
|
||||||
# environment:
|
|
||||||
# CI: true
|
|
||||||
# commands:
|
|
||||||
# - cd frontend
|
|
||||||
# - yarn test
|
|
||||||
|
|
||||||
- name: Build and push frontend dev image
|
- name: Build and push frontend dev image
|
||||||
image: plugins/docker
|
image: plugins/docker
|
||||||
settings:
|
settings:
|
||||||
@@ -153,10 +132,7 @@ steps:
|
|||||||
mount:
|
mount:
|
||||||
- frontend/node_modules
|
- frontend/node_modules
|
||||||
when:
|
when:
|
||||||
event: push
|
status: [ success, failure ]
|
||||||
status:
|
|
||||||
- success
|
|
||||||
- failure
|
|
||||||
|
|
||||||
- name: Flush cache
|
- name: Flush cache
|
||||||
image: plugins/s3-cache:1
|
image: plugins/s3-cache:1
|
||||||
@@ -172,14 +148,11 @@ steps:
|
|||||||
debug: true
|
debug: true
|
||||||
filename: frontend-dev.tar
|
filename: frontend-dev.tar
|
||||||
when:
|
when:
|
||||||
status:
|
status: [ success, failure ]
|
||||||
- success
|
|
||||||
- failure
|
|
||||||
|
|
||||||
trigger:
|
trigger:
|
||||||
exclude:
|
event: [ push, pull_request, promote ]
|
||||||
branch:
|
# refs: [ refs/heads/release/*, refs/heads/master, refs/heads/feature/*, refs/heads/hotfix/* ]
|
||||||
- release/*
|
|
||||||
|
|
||||||
---
|
---
|
||||||
kind: pipeline
|
kind: pipeline
|
||||||
@@ -214,11 +187,6 @@ steps:
|
|||||||
- ls -la
|
- ls -la
|
||||||
- npm run test:cov
|
- npm run test:cov
|
||||||
|
|
||||||
# - name: Run E2E tests
|
|
||||||
# image: node
|
|
||||||
# - cd backend
|
|
||||||
# - npm run test:e2e
|
|
||||||
|
|
||||||
- name: Build and push backend image
|
- name: Build and push backend image
|
||||||
image: plugins/docker
|
image: plugins/docker
|
||||||
settings:
|
settings:
|
||||||
@@ -248,10 +216,7 @@ steps:
|
|||||||
mount:
|
mount:
|
||||||
- backend/node_modules
|
- backend/node_modules
|
||||||
when:
|
when:
|
||||||
event: push
|
status: [ success, failure ]
|
||||||
status:
|
|
||||||
- success
|
|
||||||
- failure
|
|
||||||
|
|
||||||
- name: Flush cache
|
- name: Flush cache
|
||||||
image: plugins/s3-cache:1
|
image: plugins/s3-cache:1
|
||||||
@@ -267,15 +232,11 @@ steps:
|
|||||||
debug: true
|
debug: true
|
||||||
filename: backend.tar
|
filename: backend.tar
|
||||||
when:
|
when:
|
||||||
status:
|
status: [ success, failure ]
|
||||||
- success
|
|
||||||
- failure
|
|
||||||
|
|
||||||
trigger:
|
trigger:
|
||||||
branch:
|
event: [ tag, promote ]
|
||||||
- release/*
|
refs: [ refs/heads/release/*, refs/tags/* ]
|
||||||
ref:
|
|
||||||
- refs/tags/* # only trigger when tagging
|
|
||||||
|
|
||||||
---
|
---
|
||||||
kind: pipeline
|
kind: pipeline
|
||||||
@@ -309,11 +270,6 @@ steps:
|
|||||||
- cd backend
|
- cd backend
|
||||||
- npm run test:cov
|
- npm run test:cov
|
||||||
|
|
||||||
# - name: Run E2E tests
|
|
||||||
# image: node
|
|
||||||
# - cd backend
|
|
||||||
# - npm run test:e2e
|
|
||||||
|
|
||||||
- name: Build and push backend dev image
|
- name: Build and push backend dev image
|
||||||
image: plugins/docker
|
image: plugins/docker
|
||||||
settings:
|
settings:
|
||||||
@@ -343,10 +299,7 @@ steps:
|
|||||||
mount:
|
mount:
|
||||||
- backend/node_modules
|
- backend/node_modules
|
||||||
when:
|
when:
|
||||||
event: push
|
status: [ success, failure ]
|
||||||
status:
|
|
||||||
- success
|
|
||||||
- failure
|
|
||||||
|
|
||||||
- name: Flush cache
|
- name: Flush cache
|
||||||
image: plugins/s3-cache:1
|
image: plugins/s3-cache:1
|
||||||
@@ -362,11 +315,8 @@ steps:
|
|||||||
debug: true
|
debug: true
|
||||||
filename: backend-dev.tar
|
filename: backend-dev.tar
|
||||||
when:
|
when:
|
||||||
status:
|
status: [ success, failure ]
|
||||||
- success
|
|
||||||
- failure
|
|
||||||
|
|
||||||
trigger:
|
trigger:
|
||||||
exclude:
|
event: [ push, pull_request, promote ]
|
||||||
branch:
|
# refs: [ refs/heads/master, refs/heads/feature/*, refs/heads/hotfix/* ]
|
||||||
- release/*
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "ts-onlinetime-ranks-backend",
|
"name": "ts-onlinetime-ranks-backend",
|
||||||
"version": "0.0.2",
|
"version": "0.1.0",
|
||||||
"description": "Backend microservice for TeamSpeak 3 Online Time Ranking",
|
"description": "Backend microservice for TeamSpeak 3 Online Time Ranking",
|
||||||
"private": true,
|
"private": true,
|
||||||
"license": "UNLICENSED",
|
"license": "UNLICENSED",
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "ts-onlinetime-ranks-frontend",
|
"name": "ts-onlinetime-ranks-frontend",
|
||||||
"version": "0.0.2",
|
"version": "0.1.0",
|
||||||
"private": true,
|
"private": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@fortawesome/fontawesome-svg-core": "^1.2.32",
|
"@fortawesome/fontawesome-svg-core": "^1.2.32",
|
||||||
@@ -10,7 +10,7 @@
|
|||||||
"@testing-library/react": "^9.3.2",
|
"@testing-library/react": "^9.3.2",
|
||||||
"@testing-library/user-event": "^7.1.2",
|
"@testing-library/user-event": "^7.1.2",
|
||||||
"@types/jest": "^24.0.0",
|
"@types/jest": "^24.0.0",
|
||||||
"@types/node": "^12.0.0",
|
"@types/node": "^14.14.25",
|
||||||
"husky": "^4.3.7",
|
"husky": "^4.3.7",
|
||||||
"lint-staged": "^10.5.3",
|
"lint-staged": "^10.5.3",
|
||||||
"prettier": "^2.2.1",
|
"prettier": "^2.2.1",
|
||||||
|
|||||||
16
frontend/src/configs/api.config.ts
Normal file
16
frontend/src/configs/api.config.ts
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
export default class APIConfiguration {
|
||||||
|
private static API_DEV = "https://api.beta.tsotr.humenius.me"
|
||||||
|
private static API_PROD = "https://api.tsotr.humenius.me"
|
||||||
|
private static API_LOCAL = "http://localhost:3500"
|
||||||
|
|
||||||
|
public static getUrl = (): string => {
|
||||||
|
switch (process.env.NODE_ENV) {
|
||||||
|
case 'production':
|
||||||
|
return APIConfiguration.API_PROD;
|
||||||
|
case 'development':
|
||||||
|
return APIConfiguration.API_DEV;
|
||||||
|
default:
|
||||||
|
return APIConfiguration.API_LOCAL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,10 +1,10 @@
|
|||||||
|
import APIConfiguration from "../configs/api.config";
|
||||||
import RequestError from "../models/RequestError";
|
import RequestError from "../models/RequestError";
|
||||||
import UserStatsResponse from "../models/UserStatsResponse";
|
import UserStatsResponse from "../models/UserStatsResponse";
|
||||||
|
|
||||||
export default class UserStatsService {
|
export default class UserStatsService {
|
||||||
|
|
||||||
private static apiURL = 'https://api.tsotr.humenius.me/stats'
|
private static readonly API_URL = APIConfiguration.getUrl();
|
||||||
//private static apiURL = 'http://localhost:3500/stats'
|
|
||||||
|
|
||||||
private static requestInit: RequestInit = {
|
private static requestInit: RequestInit = {
|
||||||
method: 'GET',
|
method: 'GET',
|
||||||
@@ -14,7 +14,7 @@ export default class UserStatsService {
|
|||||||
};
|
};
|
||||||
|
|
||||||
public static async getStats(seasonId?: string): Promise<UserStatsResponse> {
|
public static async getStats(seasonId?: string): Promise<UserStatsResponse> {
|
||||||
return fetch(`${this.apiURL}/season/${seasonId ?? ''}`, this.requestInit)
|
return fetch(`${UserStatsService.API_URL}/stats/season/${seasonId ?? ''}`, this.requestInit)
|
||||||
.then(res => UserStatsService.checkResponse(res))
|
.then(res => UserStatsService.checkResponse(res))
|
||||||
.then(data => data.json())
|
.then(data => data.json())
|
||||||
.then(data => {
|
.then(data => {
|
||||||
|
|||||||
@@ -1716,10 +1716,10 @@
|
|||||||
resolved "https://registry.yarnpkg.com/@types/node/-/node-14.14.20.tgz#f7974863edd21d1f8a494a73e8e2b3658615c340"
|
resolved "https://registry.yarnpkg.com/@types/node/-/node-14.14.20.tgz#f7974863edd21d1f8a494a73e8e2b3658615c340"
|
||||||
integrity sha512-Y93R97Ouif9JEOWPIUyU+eyIdyRqQR0I8Ez1dzku4hDx34NWh4HbtIc3WNzwB1Y9ULvNGeu5B8h8bVL5cAk4/A==
|
integrity sha512-Y93R97Ouif9JEOWPIUyU+eyIdyRqQR0I8Ez1dzku4hDx34NWh4HbtIc3WNzwB1Y9ULvNGeu5B8h8bVL5cAk4/A==
|
||||||
|
|
||||||
"@types/node@^12.0.0":
|
"@types/node@^14.14.25":
|
||||||
version "12.19.12"
|
version "14.14.25"
|
||||||
resolved "https://registry.yarnpkg.com/@types/node/-/node-12.19.12.tgz#04793c2afa4ce833a9972e4c476432e30f9df47b"
|
resolved "https://registry.yarnpkg.com/@types/node/-/node-14.14.25.tgz#15967a7b577ff81383f9b888aa6705d43fbbae93"
|
||||||
integrity sha512-UwfL2uIU9arX/+/PRcIkT08/iBadGN2z6ExOROA2Dh5mAuWTBj6iJbQX4nekiV5H8cTrEG569LeX+HRco9Cbxw==
|
integrity sha512-EPpXLOVqDvisVxtlbvzfyqSsFeQxltFbluZNRndIb8tr9KiBnYNLzrc1N3pyKUCww2RNrfHDViqDWWE1LCJQtQ==
|
||||||
|
|
||||||
"@types/parse-json@^4.0.0":
|
"@types/parse-json@^4.0.0":
|
||||||
version "4.0.0"
|
version "4.0.0"
|
||||||
|
|||||||
Reference in New Issue
Block a user