Skip to content
This repository has been archived by the owner on Dec 28, 2018. It is now read-only.

Commit

Permalink
tslint + ignore unusable route
Browse files Browse the repository at this point in the history
  • Loading branch information
SkYNewZ committed Mar 31, 2018
1 parent 3a80b1b commit 7f81b0b
Showing 1 changed file with 38 additions and 35 deletions.
73 changes: 38 additions & 35 deletions src/routes/pve.ts
Original file line number Diff line number Diff line change
@@ -1,39 +1,42 @@
import { fortniteAPI } from '../tools/auth'
import { CustomError } from '../models/error'
import { Response, Request } from 'express'
import { Request, Response } from "express";
import { CustomError } from "../models/error";
import { fortniteAPI } from "../tools/auth";

export function getStatsPVE (req: Request, res: Response) {
let username = req.params.username
fortniteAPI.login()
.then(() => {
fortniteAPI.getStatsPVE(username)
.then((stats) => {
res.json(stats)
})
.catch((err) => {
if (err === 'Player Not Found') {
res.status(404).send(new CustomError(404, err))
} /* istanbul ignore next */ else if (err === 'No Data') {
res.status(400).send(new CustomError(400, err))
} else {
/* istanbul ignore next */
res.status(500).send(new CustomError(500, err))
}
})
})
/* istanbul ignore next */
export function getStatsPVE(req: Request, res: Response) {
const username = req.params.username;
fortniteAPI.login().then(() => {
fortniteAPI
.getStatsPVE(username)
.then((stats) => {
res.json(stats);
})
.catch((err) => {
if (err === "Player Not Found") {
res.status(404).send(new CustomError(404, err));
} else if (err === "No Data") {
/* istanbul ignore next */ res
.status(400)
.send(new CustomError(400, err));
} else {
/* istanbul ignore next */
res.status(500).send(new CustomError(500, err));
}
});
});
}

export function getFortnitePVEInfo (req: Request, res: Response) {
let language = req.params.lang || 'en'
fortniteAPI.login()
.then(() => {
fortniteAPI.getFortnitePVEInfo(language)
.then((store) => {
res.json(store)
})
.catch((err) => {
/* istanbul ignore next */
res.status(500).send(new CustomError(500, err))
})
})
export function getFortnitePVEInfo(req: Request, res: Response) {
const language = req.params.lang || "en";
fortniteAPI.login().then(() => {
fortniteAPI
.getFortnitePVEInfo(language)
.then((store) => {
res.json(store);
})
.catch((err) => {
/* istanbul ignore next */
res.status(500).send(new CustomError(500, err));
});
});
}

0 comments on commit 7f81b0b

Please sign in to comment.