Skip to content

Commit 9cf5301

Browse files
committed
fix missing .env file and some other things
1 parent e6b78ba commit 9cf5301

File tree

9 files changed

+63
-86
lines changed

9 files changed

+63
-86
lines changed

.vscode/tasks.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@
33
"tasks": [
44
{
55
"type": "npm",
6-
"script": "lint:fix",
6+
"script": "lint",
77
"path": "client",
88
"group": "none",
99
"problemMatcher": ["$eslint-stylish"],
10-
"label": "npm run lint:fix - client",
10+
"label": "npm run lint - client",
1111
"detail": "eslint --fix"
1212
},
1313
{

client/.env.example

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
APP_ENV=DEVELOPMENT
2+
VITE_BACKEND_URL="http://localhost:8000/api"

client/package-lock.json

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

client/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@
55
"type": "module",
66
"scripts": {
77
"dev": "vite --port 3000",
8-
"build": "run-p type-check \"build-only {@}\" --",
8+
"build": "run-p typecheck \"build-only {@}\" --",
99
"preview": "vite preview",
1010
"build-only": "vite build",
1111
"typecheck": "vue-tsc --build --force",
12-
"lint:fix": "eslint --fix",
12+
"lint": "eslint --fix",
1313
"lint:strict": "eslint",
1414
"format": "prettier --write src/",
1515
"format:check": "prettier --check src/"

client/src/App.vue

Lines changed: 3 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -1,57 +1,9 @@
11
<script setup lang="ts">
2-
import { RouterLink, RouterView } from 'vue-router'
3-
import HelloWorld from './components/HelloWorld.vue'
4-
import { ref } from 'vue'
5-
import server from './utils/server.ts'
6-
7-
const isLoading = ref(false)
8-
const healthcheckMessage = ref('')
9-
10-
const handlePing = async () => {
11-
isLoading.value = true
12-
healthcheckMessage.value = '' // Clear previous messages
13-
14-
try {
15-
const response = await server.get('/healthcheck/ping/')
16-
healthcheckMessage.value = response.data
17-
} catch (error) {
18-
healthcheckMessage.value = 'Failed to ping server'
19-
} finally {
20-
isLoading.value = false
21-
}
22-
}
2+
import { RouterView } from 'vue-router'
233
</script>
244

255
<template>
26-
<div id="healthcheck">
27-
<h1>Test Title</h1>
28-
<button id="ping" @click="handlePing" :disabled="isLoading">
29-
{{ isLoading ? 'Loading' : 'Ping' }}
30-
</button>
31-
<p>
32-
Response from server: <span>{{ healthcheckMessage }}</span>
33-
</p>
34-
</div>
6+
<RouterView />
357
</template>
368

37-
<style scoped>
38-
#healthcheck {
39-
display: flex;
40-
flex-direction: column;
41-
place-items: center;
42-
height: 80vh;
43-
}
44-
45-
#ping {
46-
background-color: var(--color-text);
47-
color: var(--color-background);
48-
border: none;
49-
border-radius: 2px;
50-
padding: 8px 16px;
51-
margin: 8px;
52-
}
53-
54-
#ping:hover {
55-
filter: brightness(80%);
56-
}
57-
</style>
9+
<style></style>

client/src/router/index.ts

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,6 @@ const router = createRouter({
99
name: 'home',
1010
component: HomeView,
1111
},
12-
{
13-
path: '/about',
14-
name: 'about',
15-
// route level code-splitting
16-
// this generates a separate chunk (About.[hash].js) for this route
17-
// which is lazy-loaded when the route is visited.
18-
component: () => import('../views/AboutView.vue'),
19-
},
2012
],
2113
})
2214

client/src/utils/server.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
import axios from 'axios'
22

3-
const server = axios.create({ baseURL: import.meta.env.VITE_BACKEND_URL })
3+
const server = axios.create({ baseURL: import.meta.env.VITE_BACKEND_URL, timeout: 8000 })
44
export default server

client/src/views/AboutView.vue

Lines changed: 0 additions & 15 deletions
This file was deleted.

client/src/views/HomeView.vue

Lines changed: 50 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,55 @@
11
<script setup lang="ts">
2-
import TheWelcome from '../components/TheWelcome.vue'
2+
import { ref } from 'vue'
3+
import server from '@/utils/server';
4+
5+
const isLoading = ref(false)
6+
const healthcheckMessage = ref('')
7+
8+
const handlePing = async () => {
9+
isLoading.value = true
10+
healthcheckMessage.value = '' // Clear previous messages
11+
12+
try {
13+
const response = await server.get('/healthcheck/ping/')
14+
healthcheckMessage.value = response.data
15+
} catch {
16+
healthcheckMessage.value = 'Failed to ping server'
17+
} finally {
18+
isLoading.value = false
19+
}
20+
}
321
</script>
422

523
<template>
6-
<main>
7-
<TheWelcome />
8-
</main>
24+
<div id="healthcheck">
25+
<h1>Healthcheck</h1>
26+
<button id="ping" @click="handlePing" :disabled="isLoading">
27+
{{ isLoading ? 'Loading' : 'Ping' }}
28+
</button>
29+
<p>
30+
Response from server: <span>{{ healthcheckMessage }}</span>
31+
</p>
32+
</div>
933
</template>
34+
35+
<style scoped>
36+
#healthcheck {
37+
display: flex;
38+
flex-direction: column;
39+
place-items: center;
40+
height: 80vh;
41+
}
42+
43+
#ping {
44+
background-color: var(--color-text);
45+
color: var(--color-background);
46+
border: none;
47+
border-radius: 2px;
48+
padding: 8px 16px;
49+
margin: 8px;
50+
}
51+
52+
#ping:hover {
53+
filter: brightness(80%);
54+
}
55+
</style>

0 commit comments

Comments
 (0)