Tiny fixes

This commit is contained in:
forceoranj
2021-10-16 02:45:10 +02:00
parent ebdd8dccdd
commit 40640ef544
4 changed files with 7 additions and 77 deletions

View File

@@ -2,6 +2,7 @@ export default {
HOST: "localhost",
PORT: 3000,
API_URL: "",
GOOGLE_SHEET_ID: "1pMMKcYx6NXLOqNn6pLHJTPMTOLRYZmSNg2QQcAu7-Pw",
APP: {
htmlAttributes: { lang: "en" },
title: "REACT COOL STARTER",

View File

@@ -4,6 +4,7 @@ import readline from "readline"
import _ from "lodash"
import { Request, Response, NextFunction } from "express"
import { google } from "googleapis"
import config from "../config"
const SCOPES = ["https://www.googleapis.com/auth/spreadsheets"]
const TOKEN_PATH = path.resolve(process.cwd(), "access/token.json")
@@ -18,12 +19,11 @@ export const getJAVGameList = async (
const auth = await authorize(JSON.parse(fs.readFileSync(CRED_PATH, "utf8")))
const sheets = google.sheets({ version: "v4", auth })
const r = await sheets.spreadsheets.values.get({
spreadsheetId: "1pMMKcYx6NXLOqNn6pLHJTPMTOLRYZmSNg2QQcAu7-Pw",
range: "Ongoing!A1:T",
spreadsheetId: config.GOOGLE_SHEET_ID,
range: "JAV Games!A1:Z",
})
console.log("r?.data?.values", r?.data?.values)
if (r?.data?.values && _.isArray(r.data.values)) {
if (_.isArray(r?.data?.values)) {
const list = _.map(r.data.values, (val: any) => ({
id: val[0],
titre: val[1],