refactor
This commit is contained in:
parent
d41e239c5e
commit
27ed2f70c6
62
.vscode/settings.json
vendored
Executable file
62
.vscode/settings.json
vendored
Executable file
@ -0,0 +1,62 @@
|
|||||||
|
{
|
||||||
|
// ============================
|
||||||
|
// Editor basics
|
||||||
|
// ============================
|
||||||
|
"editor.tabSize": 2,
|
||||||
|
"editor.insertSpaces": true,
|
||||||
|
"editor.formatOnSave": true,
|
||||||
|
"editor.codeActionsOnSave": {
|
||||||
|
"source.fixAll": "explicit",
|
||||||
|
"source.organizeImports": "explicit"
|
||||||
|
},
|
||||||
|
"editor.defaultFormatter": "esbenp.prettier-vscode",
|
||||||
|
|
||||||
|
// ============================
|
||||||
|
// JS / TS behavior
|
||||||
|
// ============================
|
||||||
|
"javascript.updateImportsOnFileMove.enabled": "always",
|
||||||
|
"typescript.updateImportsOnFileMove.enabled": "always",
|
||||||
|
"javascript.suggest.autoImports": true,
|
||||||
|
"typescript.suggest.autoImports": true,
|
||||||
|
|
||||||
|
// Fix annoying "JSX not allowed" issues in js files
|
||||||
|
"javascript.validate.enable": false,
|
||||||
|
|
||||||
|
// ============================
|
||||||
|
// React specific
|
||||||
|
// ============================
|
||||||
|
"emmet.includeLanguages": {
|
||||||
|
"javascript": "javascriptreact",
|
||||||
|
"typescript": "typescriptreact"
|
||||||
|
},
|
||||||
|
"emmet.triggerExpansionOnTab": true,
|
||||||
|
|
||||||
|
// ============================
|
||||||
|
// Terminal
|
||||||
|
// ============================
|
||||||
|
"terminal.integrated.defaultProfile.windows": "Git Bash",
|
||||||
|
|
||||||
|
// ============================
|
||||||
|
// Prettier
|
||||||
|
// ============================
|
||||||
|
"[javascript]": { "editor.defaultFormatter": "esbenp.prettier-vscode" },
|
||||||
|
"[javascriptreact]": { "editor.defaultFormatter": "esbenp.prettier-vscode" },
|
||||||
|
"[typescript]": { "editor.defaultFormatter": "esbenp.prettier-vscode" },
|
||||||
|
"[typescriptreact]": { "editor.defaultFormatter": "esbenp.prettier-vscode" },
|
||||||
|
|
||||||
|
// ============================
|
||||||
|
// File Icons
|
||||||
|
// ============================
|
||||||
|
"workbench.iconTheme": "material-icon-theme",
|
||||||
|
|
||||||
|
// ============================
|
||||||
|
// Explorer cleanup
|
||||||
|
// ============================
|
||||||
|
"files.exclude": {
|
||||||
|
"**/.git": true,
|
||||||
|
"**/.DS_Store": true,
|
||||||
|
"**/node_modules": true,
|
||||||
|
"**/*.log": true,
|
||||||
|
"**/dist": true
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -21,13 +21,15 @@ app.use(express.json());
|
|||||||
|
|
||||||
const allowedOrigins = [
|
const allowedOrigins = [
|
||||||
"http://localhost:3000",
|
"http://localhost:3000",
|
||||||
"https://mygroceryapp.com",
|
"https://costco.nicosaya.com",
|
||||||
|
"https://costco.api.nicosaya.com",
|
||||||
];
|
];
|
||||||
app.use(cors({
|
app.use(cors({
|
||||||
origin: function (origin, callback) {
|
origin: function (origin, callback) {
|
||||||
if (!origin) return callback(null, true);
|
if (!origin) return callback(null, true);
|
||||||
if (allowedOrigins.includes(origin)) return callback(null, true);
|
if (allowedOrigins.includes(origin)) return callback(null, true);
|
||||||
if (/^http:\/\/192\.168\.\d+\.\d+/.test(origin)) return callback(null, true);
|
if (/^http:\/\/192\.168\.\d+\.\d+/.test(origin)) return callback(null, true);
|
||||||
|
if (/^https:\/\/192\.168\.\d+\.\d+/.test(origin)) return callback(null, true);
|
||||||
callback(new Error("Not allowed by CORS"));
|
callback(new Error("Not allowed by CORS"));
|
||||||
},
|
},
|
||||||
methods: ["GET", "POST"],
|
methods: ["GET", "POST"],
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
import { useState, useEffect } from "react";
|
import { useEffect, useState } from "react";
|
||||||
import SuggestionList from "./components/SuggestionList";
|
|
||||||
import GroceryItem from "./components/GroceryItem";
|
import GroceryItem from "./components/GroceryItem";
|
||||||
|
import SuggestionList from "./components/SuggestionList";
|
||||||
import type { GroceryItemType } from "./types";
|
import type { GroceryItemType } from "./types";
|
||||||
|
|
||||||
const API_BASE_URL = import.meta.env.VITE_API_URL;
|
const API_BASE_URL = import.meta.env.VITE_API_URL;
|
||||||
|
|||||||
@ -4,6 +4,7 @@ import react from '@vitejs/plugin-react'
|
|||||||
export default defineConfig({
|
export default defineConfig({
|
||||||
plugins: [react()],
|
plugins: [react()],
|
||||||
server: {
|
server: {
|
||||||
|
allowedHosts: ["costco.nicosaya.com", "www.costco.nicosaya.com"],
|
||||||
watch: {
|
watch: {
|
||||||
usePolling: true,
|
usePolling: true,
|
||||||
},
|
},
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user