Commit ca962a48 authored by Muneeb Saeed's avatar Muneeb Saeed

Google authentication added.

parent f76cd13f
......@@ -8,13 +8,11 @@ app.options('*', cors());
const bodyParser = require('body-parser')
app.use(bodyParser.json());
console.log('App Running...')
const searchService = require('./samples/interactive-tutorials/search/search-simple-query');
app.get('/search', (req, res) => {
searchService(req.query.text)
.then(result => {
// console.log('Resultss', result);
return res.send(result);
})
.catch(err => res.send(err))
......
{"web":{"client_id":"850146903364-offnkcq2ac73ugqlmi7vohoc1rjci312.apps.googleusercontent.com","project_id":"abs-poc-np-prj-01-3f2a","auth_uri":"https://accounts.google.com/o/oauth2/auth","token_uri":"https://oauth2.googleapis.com/token","auth_provider_x509_cert_url":"https://www.googleapis.com/oauth2/v1/certs","client_secret":"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","redirect_uris":["https://3001-cs-e60cf927-fc0f-43c2-b5ee-d4e6f9493653.cs-asia-southeast1-bool.cloudshell.dev/search","https://3002-cs-e60cf927-fc0f-43c2-b5ee-d4e6f9493653.cs-asia-southeast1-bool.cloudshell.dev/https://3001-cs-e60cf927-fc0f-43c2-b5ee-d4e6f9493653.cs-asia-southeast1-bool.cloudshell.dev/search"],"javascript_origins":["https://3001-cs-e60cf927-fc0f-43c2-b5ee-d4e6f9493653.cs-asia-southeast1-bool.cloudshell.dev","https://3002-cs-e60cf927-fc0f-43c2-b5ee-d4e6f9493653.cs-asia-southeast1-bool.cloudshell.dev"]}}
\ No newline at end of file
......@@ -3,6 +3,7 @@
"version": "1.0.0",
"main": "App.js",
"dependencies": {
"@google-cloud/retail": "^2.3.0",
"body-parser": "^1.20.1",
"cors": "^2.8.5",
"express": "^4.18.2",
......@@ -10,7 +11,7 @@
"nodemon": "^2.0.20"
},
"scripts": {
"dev": "nodemon App.js",
"dev": "set GOOGLE_APPLICATION_CREDENTIALS=credentials.json && nodemon App.js",
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
......
import React, { useState } from 'react';
import SearchResults from './search-results';
// import { CONFIGS } from '../client-config';
// import mockResponse from '../mock-response.json'
import { Button, Input, Col, Row } from 'antd';
import { SearchOutlined } from '@ant-design/icons';
......@@ -21,11 +19,9 @@ const Search = () => {
const handleOnSearch = async (value) => {
const { text } = value;
if (text) {
// const searchResults = mockResponse;
const searchResults = await fetch(`http://localhost:3002/search?text=${text}`)
// .then(res => res.json())
.then(res => res.data);
// console.log('searchResults', searchResults);
.then(res => res.json())
.catch(err => console.log(err));
setSearchResults(searchResults.results.length ? [...searchResults.results] : []);
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment