/** * ============================================================================== * Imports * ============================================================================== */ import React from "react"; /** ********************************************** */ /** ********************************************** */ /** ********************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** * ============================================================================== * Main Component { Functional } * ============================================================================== * @param {Object} props - Server props */ export default function Homepage(props) { // ## Get Contexts /** ********************************************** */ /** ********************************************** */ /** ********************************************** */ // ## Javascript Variables /** ********************* Head Items */ let head = ( Showmerebates | Home ); /** ********************************************** */ /** ********************************************** */ /** ********************************************** */ /** ********************************************** */ /** ********************************************** */ /** ********************************************** */ // ## React Hooks { useState, useEffect, useRef, etc ... } /** ********************************************** */ /** ********************************************** */ /** ********************************************** */ // ## Function Return return (
{ !props.user && }
); /** ********************************************** */ /** ********************************************** */ /** ********************************************** */ }; /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** * ============================================================================== * Server Side Props or Static Props * ============================================================================== * @param {Object} req - http incoming request object * @param {Object} res - http response object * @param {Object} query - queries attached to the url */ export async function getServerSideProps({ req, res, query }) { // ## Environment processes /** ********************************************** */ /** ********************************************** */ /** ********************************************** */ // ## User Authentication const user = await userAuth(req, res); /** ********************************************** */ /** ********************************************** */ /** ********************************************** */ // ## Page/Site Data Data Fetching let properties = await dbHandler(` SELECT ListingKeyNumeric,City,RoomsTotal,BathroomsFull,BathroomsTotalInteger,BedroomsTotal,UnparsedAddress,BuildingAreaTotal,ListPrice,PostalCode FROM utahapidata WHERE PhotosCount > 0 AND ListPrice > 0 AND BedroomsTotal > 0 LIMIT 3 `); /** ********************************************** */ /** ********************************************** */ /** ********************************************** */ // ## Server Props Return return { props: { user: user, data: properties, }, }; /** ********************************************** */ /** ********************************************** */ /** ********************************************** */ }