diff --git a/.github/workflows/deploy_client.yaml b/.github/workflows/deploy_client.yaml new file mode 100644 index 0000000..02cdbc9 --- /dev/null +++ b/.github/workflows/deploy_client.yaml @@ -0,0 +1,20 @@ +name: Auto Build Deploy Client +on: + push: + paths: + - client/** + branches: + - main + +jobs: + build: + runs-on: ubuntu-latest + steps: + - name: Run SSHPASS + run: | + sshpass \ + -p ${{ secrets.SSH_PASS }} \ + ssh \ + -o 'StrictHostKeyChecking no' \ + -p ${{ secrets.SSH_PORT }} ${{ secrets.SSH_USER }}@${{ secrets.SSH_HOST }} \ + 'cd /kmp/camprotec/cam-professional && git checkout main && git pull && cd client && npm i --force && npm run build && pm2 restart 23' \ No newline at end of file diff --git a/client/package.json b/client/package.json index 3bf27a8..3daa581 100644 --- a/client/package.json +++ b/client/package.json @@ -6,7 +6,8 @@ "start": "vite", "dev": "vite", "build": "vite build", - "serve": "vite preview" + "serve": "vite preview", + "db": "npx json-server ./data/db.json -p 60011" }, "license": "MIT", "devDependencies": { diff --git a/client/src/pages/home.tsx b/client/src/pages/home.tsx index deeb1e4..9e06d63 100644 --- a/client/src/pages/home.tsx +++ b/client/src/pages/home.tsx @@ -200,7 +200,7 @@ export const LatestProducts: Component<{}> = () => { export const MainProducts: Component<{}> = () => { const fetchData = async () => { - const res = await fetch("http://localhost:3000/CoreProducts"); + const res = await fetch("http://localhost:60011/CoreProducts"); return res.json(); }; const [coreProducts] = createResource(fetchData); diff --git a/client/src/pages/products/details.tsx b/client/src/pages/products/details.tsx index e1fc699..2e4f5d4 100644 --- a/client/src/pages/products/details.tsx +++ b/client/src/pages/products/details.tsx @@ -16,7 +16,7 @@ type Product = { }; const fetchProduct = async (id: string) => { - const res = await fetch(`http://localhost:3000/CoreProducts/` + id); + const res = await fetch(`http://localhost:60011/CoreProducts/` + id); return res.json(); }; const ProductDetail: Component<{}> = (props) => { diff --git a/client/src/pages/products/index.tsx b/client/src/pages/products/index.tsx index a077f01..c8bb759 100644 --- a/client/src/pages/products/index.tsx +++ b/client/src/pages/products/index.tsx @@ -1,7 +1,7 @@ import { Component, For, Show, createResource } from "solid-js"; import Cards from "../../components/cards/Cards"; const fetchData = async () => { - const res = await fetch("http://localhost:3000/CoreProducts"); + const res = await fetch("http://localhost:60011/CoreProducts"); return res.json(); }; diff --git a/client/vite.config.ts b/client/vite.config.ts index a0ae3be..7d67f78 100644 --- a/client/vite.config.ts +++ b/client/vite.config.ts @@ -4,7 +4,7 @@ import solidPlugin from "vite-plugin-solid"; export default defineConfig({ plugins: [solidPlugin()], server: { - port: 8000, + port: 60011, }, build: { target: "esnext",