Made lang settings public, Edited function params

Signed-off-by: Avior <florian.bouillon@delta-wings.net>
This commit is contained in:
Florian Bouillon 2020-03-11 10:12:38 +01:00
parent f235c62c58
commit f7044c7b10
No known key found for this signature in database
GPG Key ID: B143FF27EF555D16

View File

@ -4,8 +4,8 @@ import { SetSingle, SetRequest } from './interfaces/Set'
import { CardSingle } from './interfaces/Card'
import { ExpansionSingle } from './interfaces/Expansion'
export default class TCGDex {
private lang: Langs = "en"
export default class TCGdex {
public lang: Langs = "en"
public constructor(lang?: Langs) {
if (lang) this.lang = lang
@ -19,7 +19,9 @@ export default class TCGDex {
return this.getBaseUrl()
}
public async getCard(id: string, set?: string): Promise<CardSingle> {
public async getCard(id: string|number, set: string): Promise<CardSingle>;
public async getCard(id: string): Promise<CardSingle>;
public async getCard(id: string|number, set?: string): Promise<CardSingle> {
try {
const txt = set ? `sets/${set}` : "cards"
const resp = await fetch(`${this.gbu()}/${txt}/${id}`)