refactor: move cartUrl from Store to Link (#87)

This commit is contained in:
George
2020-09-19 19:49:09 -07:00
committed by GitHub
parent 381f1f7505
commit 1e9d8fec42
3 changed files with 9 additions and 2 deletions
+1 -1
View File
@@ -70,7 +70,7 @@ export async function lookup(browser: puppeteer.Browser, store: Store) {
await page.screenshot({path: `success-${Date.now()}.png`});
}
const givenUrl = store.cartUrl ? store.cartUrl : link.url;
const givenUrl = link.cartUrl ? link.cartUrl : link.url;
if (Config.openBrowser === 'true') {
await open(givenUrl);
+7
View File
@@ -3,42 +3,49 @@ import {Store} from './store';
export const BestBuy: Store = {
links: [
{
cartUrl: 'https://api.bestbuy.com/click/-/6432445/cart',
brand: 'asus',
model: 'rog strix',
url: 'https://www.bestbuy.com/site/asus-geforce-rtx-3080-10gb-gddr6x-pci-express-4-0-strix-graphics-card-black/6432445.p?skuId=6432445',
oosLabels: ['sold out', 'coming soon']
},
{
cartUrl: 'https://api.bestbuy.com/click/-/6432399/cart',
brand: 'evga',
model: 'xc3 black',
url: 'https://www.bestbuy.com/site/evga-geforce-rtx-3080-10gb-gddr6x-pci-express-4-0-graphics-card/6432399.p?skuId=6432399',
oosLabels: ['sold out', 'coming soon']
},
{
cartUrl: 'https://api.bestbuy.com/click/-/6432400/cart',
brand: 'evga',
model: 'xc3 ultra',
url: 'https://www.bestbuy.com/site/evga-geforce-rtx-3080-10gb-gddr6x-pci-express-4-0-graphics-card/6432400.p?skuId=6432400',
oosLabels: ['sold out', 'coming soon']
},
{
cartUrl: 'https://api.bestbuy.com/click/-/6430620/cart',
brand: 'gigabyte',
model: 'black',
url: 'https://www.bestbuy.com/site/gigabyte-geforce-rtx-3080-10g-gddr6x-pci-express-4-0-graphics-card-black/6430620.p?acampID=0&cmp=RMX&loc=Hatch&ref=198&skuId=6430620',
oosLabels: ['sold out', 'coming soon']
},
{
cartUrl: 'https://api.bestbuy.com/click/-/6430621/cart',
brand: 'gigabyte',
model: 'eagle',
url: 'https://www.bestbuy.com/site/gigabyte-geforce-rtx-3080-10g-gddr6x-pci-express-4-0-graphics-card-black/6430621.p?skuId=6430621',
oosLabels: ['sold out', 'coming soon']
},
{
cartUrl: 'https://api.bestbuy.com/click/-/6430175/cart',
brand: 'msi',
model: 'ventus 3x',
url: 'https://www.bestbuy.com/site/msi-geforce-rtx-3080-ventus-3x-10g-oc-bv-gddr6x-pci-express-4-0-graphic-card-black-silver/6430175.p?skuId=6430175',
oosLabels: ['sold out', 'coming soon']
},
{
cartUrl: 'https://api.bestbuy.com/click/-/6429440/cart',
brand: 'nvidia',
model: 'founder edition',
url: 'https://www.bestbuy.com/site/nvidia-geforce-rtx-3080-10gb-gddr6x-pci-express-4-0-graphics-card-titanium-and-black/6429440.p?skuId=6429440',
+1 -1
View File
@@ -1,4 +1,5 @@
interface Link {
cartUrl?: string;
brand: string;
model: string;
url: string;
@@ -7,7 +8,6 @@ interface Link {
}
export interface Store {
cartUrl?: string;
links: Link[];
name: string;
}