{"ast":null,"code":"import { jsx as _jsx } from \"react/jsx-runtime\";\nimport { jsxs as _jsxs } from \"react/jsx-runtime\";\nimport axios from 'axios';\nimport Head from 'next/head';\nimport React from 'react';\nimport BuildHeader from '../../components/header.js';\nimport TableBuilder from '../../components/tablefilter.js';\n\nfunction teamHistory({\n  fulldataset\n}) {\n  //console.log(fulldataset)\n  return /*#__PURE__*/_jsxs(\"div\", {\n    children: [/*#__PURE__*/_jsx(BuildHeader, {\n      headerData: fulldataset.headerdata\n    }), /*#__PURE__*/_jsxs(\"div\", {\n      className: \"container mx-auto\",\n      children: [fulldataset.historydataset != null && /*#__PURE__*/_jsx(\"h3\", {\n        className: \"text-3xl\",\n        children: \"This Season's Team Data\"\n      }), /*#__PURE__*/_jsx(TableBuilder, {\n        baseURL: fulldataset.currentdataset.baseURL,\n        props: fulldataset.currentdataset\n      }, 'current')]\n    }), fulldataset.historydataset != null && /*#__PURE__*/_jsxs(\"div\", {\n      className: \"container mx-auto\",\n      children: [/*#__PURE__*/_jsx(\"h3\", {\n        className: \"text-3xl\",\n        children: \"Historical Team Data\"\n      }), /*#__PURE__*/_jsx(TableBuilder, {\n        baseURL: fulldataset.historydataset.baseURL,\n        props: fulldataset.historydataset\n      }, \"historical\")]\n    })]\n  });\n}\n\nexport default teamHistory;\nexport async function getServerSideProps(context) {\n  const urlData = context.resolvedUrl.split('?')[1];\n  const res = await axios.get('https://goallinestats.com/phpAPI/teamstatsJSON.php?request=current&' + urlData);\n  var dataset = res.data;\n  dataset['baseURL'] = 'https://goallinestats.com/phpAPI/teamstatsJSON.php?request=current&' + urlData; //console.log(urlData.includes(\"team\"))\n\n  if (urlData.includes(\"team\") == true) {\n    const reshistory = await axios.get('https://goallinestats.com/phpAPI/teamstatsJSON.php?request=history&' + urlData);\n    var historydata = reshistory.data;\n    historydata['baseURL'] = 'https://goallinestats.com/phpAPI/teamstatsJSON.php?request=history&' + urlData;\n  } else {\n    var historydata = null;\n  }\n\n  const index = await axios.get('https://goallinestats.com/phpAPI/headerJSON.php?' + urlData);\n  const indexData = index.data;\n  const fulldataset = {\n    headerdata: indexData,\n    currentdataset: dataset,\n    historydataset: historydata\n  }; // Pass data to the page via props\n  //console.log(historydata)\n\n  return {\n    props: {\n      fulldataset\n    }\n  };\n}","map":null,"metadata":{},"sourceType":"module"}