Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: tweaks for nuxt data fetch #1

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion backend/.env
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
FLASK_APP=app
FLASK_RUN_PORT=54321
FLASK_RUN_PORT=5000
FLASK_DEBUG=True
3 changes: 1 addition & 2 deletions backend/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from flask_cors import CORS

# from werkzeug.security import generate_password_hash, check_password_hash
locale.setlocale(locale.LC_ALL, "cs_CZ.utf8")
# locale.setlocale(locale.LC_ALL, "cs_CZ.utf8")

app = Flask(__name__)
CORS(app)
Expand Down Expand Up @@ -64,7 +64,6 @@ def get(self, nick, IP):
# print(f"{nick}: Create at {self[nick].ctime}. Use at {self[nick].atime}.")
return r


@app.route("/", methods=["GET"])
def index():
return send_from_directory(".", "index.html")
Expand Down
15 changes: 15 additions & 0 deletions default.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@


server {
server_name domena.cz

location ~ /api {
#flask API
proxy_pass http://localhost:8080;
}

location / {
root /frontend/public;
try_files $uri $uri/ /index.html;
}
}
18 changes: 16 additions & 2 deletions frontend/pages/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,11 @@ table {

<h2>Table of nicks</h2>

<pre>
pending: {{ loadedData.pending }}
err: {{ loadedData.error }}
</pre>

<table>
<thead>
<tr>
Expand Down Expand Up @@ -130,13 +135,21 @@ const sorting= reactive({
})

// data
const { data: table } = await useFetch('http://localhost:54321/status');
// const { data: table } = await useFetch('http://localhost:54321/status');
//table.value = bagr.value
//console.log(table.value)
/*const response = await useFetch('http://localhost:54321/status');*/
/*console.log(response)*/


const loadedData = useFetch('http://127.0.0.1:5000/status');

const table2 = computed( () => {
const table = loadedData.data

if (loadedData.data.value == null)
return [];

let tab = [];

const nick_re = nick.value == '' ? new RegExp(/.*/) : new RegExp(nick.value,"i");
Expand Down Expand Up @@ -260,7 +273,8 @@ const refreshing = ref(false)
const refreshAll = async () => {
refreshing.value = true
try {
await refreshNuxtData()
await loadedData.refresh()
// await refreshNuxtData()
}
finally {
refreshing.value = false
Expand Down