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

improve: update code to main #460

Merged
merged 128 commits into from
Jul 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
128 commits
Select commit Hold shift + click to select a range
055a684
Merge branch 'development' of https://github.com/techcomrade/fmECG in…
DuckDuon175 May 23, 2024
f9a8da2
improve(front-end): update chart connect api
Huyz109 Jun 7, 2024
f11397c
bug: fix bug upload file
hwt75 Jun 8, 2024
a299390
Merge pull request #387 from techcomrade/improve/upload_file
hwt75 Jun 8, 2024
4a171bb
improve(front-end): update chart title
Huyz109 Jun 8, 2024
bed683b
improve(front-end): convert device type to text in device table, add …
DuckDuon175 Jun 9, 2024
a17ef35
feature(front-end): add bubble chat component
Huyz109 Jun 9, 2024
7c9e0c5
Merge pull request #389 from techcomrade/feature/device_api
hwt75 Jun 10, 2024
2ba72e4
Merge pull request #391 from techcomrade/feature/bubble-chat
hwt75 Jun 10, 2024
3836aa0
Merge branch 'development' into improve/chart
hwt75 Jun 10, 2024
a6faa2d
Merge pull request #388 from techcomrade/improve/chart
hwt75 Jun 10, 2024
008f954
feature: improve home ui issue #111
hwt75 Jun 10, 2024
2647464
Merge pull request #392 from techcomrade/feature/home_ui
hwt75 Jun 10, 2024
e22c326
feature: fix bug home ui issue #111
hwt75 Jun 10, 2024
6fba59b
Merge pull request #393 from techcomrade/feature/home_design
hwt75 Jun 10, 2024
6473436
bug: fix bug issue #116 bug issue #114
hwt75 Jun 10, 2024
efa787f
Merge pull request #394 from techcomrade/feature/home_design
hwt75 Jun 10, 2024
44409b7
fix(back-end): add record_name field in get all records
DuckDuon175 Jun 10, 2024
1a45479
Merge pull request #395 from techcomrade/feature/records_api
hwt75 Jun 10, 2024
fe8414c
feature(back-end): insert data to conversations table server chat
thaidmfinnick Jun 11, 2024
ebf0b86
improve: issue #39 register new user
hwt75 Jun 12, 2024
0edc4dd
Merge pull request #397 from techcomrade/improve/upload_file
hwt75 Jun 12, 2024
2626bd2
#112 improve(back-end): update data record return in get data record api
Tran-Xuan-Quyen Jun 12, 2024
2f0ef8a
fix(back-end): delete console log
Tran-Xuan-Quyen Jun 12, 2024
3a42d5f
fix(back-end): format files according to standards
Tran-Xuan-Quyen Jun 12, 2024
3528381
feature(back-end): update new db server chat
thaidmfinnick Jun 12, 2024
2f1cf38
feature: chat gpt feature, assignment feature, register check feature
hwt75 Jun 13, 2024
f32965a
feature: add certs for open ai
hwt75 Jun 13, 2024
b01bc1d
feature: update cert for openai
hwt75 Jun 13, 2024
ab013b5
Merge pull request #399 from techcomrade/feature/chat_gpt
hwt75 Jun 13, 2024
ff4d3bf
Merge pull request #398 from techcomrade/update_get_data_record_api
hwt75 Jun 13, 2024
ba3e04d
fix(front-end): fix data chart match api
Huyz109 Jun 13, 2024
cba798b
fix(front-end): fix sidebar icon
Huyz109 Jun 13, 2024
7b830a6
fix(front-end): hide button modal chart
Huyz109 Jun 13, 2024
f3ed600
feature: chat with ai issue #98
hwt75 Jun 13, 2024
4064469
Merge pull request #401 from techcomrade/feature/chat_gpt
hwt75 Jun 13, 2024
ce2e2e8
Merge pull request #400 from techcomrade/fix/bug-chart
hwt75 Jun 13, 2024
aaab26f
feature: issue #120 assignment
hwt75 Jun 13, 2024
fe6e736
Merge pull request #402 from techcomrade/feature/chat_gpt
hwt75 Jun 13, 2024
0ad776b
improve(back-end): complete api with creating conversation
thaidmfinnick Jun 13, 2024
e8334b0
improve(back-end): generate formular for conversation id
thaidmfinnick Jun 14, 2024
bb6dc53
improve(back-end): complete api send message
thaidmfinnick Jun 14, 2024
72816ef
improve(mobile): update logic socket and test call api to different s…
thaidmfinnick Jun 14, 2024
a67fd68
Merge pull request #396 from techcomrade/issue_31_server/crud_server_…
thaidmfinnick Jun 14, 2024
529ee82
fix(back-end): fix duplicate in get all device api
DuckDuon175 Jun 15, 2024
5b17b78
Merge branch 'development' of https://github.com/techcomrade/fmECG in…
DuckDuon175 Jun 15, 2024
644a924
#39 improve(back-end): code register api
Tran-Xuan-Quyen Jun 15, 2024
0bcd246
feature(front-end): add user registration information table
DuckDuon175 Jun 15, 2024
4ebc447
improve(back-end): fix get all data api in authen controller, add get…
DuckDuon175 Jun 15, 2024
a4fba47
Merge pull request #403 from techcomrade/feature/device_api
hwt75 Jun 15, 2024
0770f36
Merge pull request #405 from techcomrade/feature/register
hwt75 Jun 15, 2024
e0234a0
Merge pull request #404 from techcomrade/register_api
hwt75 Jun 15, 2024
9b454ac
fix(front-end): fix bubble chat ui
Huyz109 Jun 16, 2024
138f58c
feature(front-end): add doctor-patient chat page
Huyz109 Jun 16, 2024
686260d
Merge pull request #406 from techcomrade/feature/chat
hwt75 Jun 17, 2024
01bdce1
improve(docker): makefile for frontend
thaidmfinnick Jun 17, 2024
1698499
Merge pull request #407 from techcomrade/fix/makefile
thaidmfinnick Jun 17, 2024
8682e59
improve(docker): profile frontend
thaidmfinnick Jun 17, 2024
43ecbdb
Merge pull request #408 from techcomrade/fix/makefile
thaidmfinnick Jun 17, 2024
534abb2
fix(docker ): init server chat
thaidmfinnick Jun 17, 2024
a17ffcb
Merge pull request #409 from techcomrade/fix/makefile
thaidmfinnick Jun 17, 2024
f3a57c8
feature(server): add api get messages and format code
thaidmfinnick Jun 18, 2024
0f72297
improve(server): remove log
thaidmfinnick Jun 18, 2024
3f704e1
Merge pull request #410 from techcomrade/feature/add_api_get_all_mess…
thaidmfinnick Jun 18, 2024
67a77b0
bug: fix bug server
hwt75 Jun 20, 2024
d578351
Merge pull request #414 from techcomrade/bug/hot-fix
hwt75 Jun 20, 2024
62cdae7
bug: fix file name error
hwt75 Jun 20, 2024
7b55f76
Merge pull request #415 from techcomrade/bug/hot-fix
hwt75 Jun 20, 2024
bcbe7ab
improve(docker): update makefile
thaidmfinnick Jun 20, 2024
9b8c82f
Merge pull request #416 from techcomrade/improve_docker/update_makefile
thaidmfinnick Jun 20, 2024
c43c7c4
fix bug docker make app
hwt75 Jun 21, 2024
6aef4af
Merge pull request #417 from techcomrade/feature/device_detail
hwt75 Jun 21, 2024
16233e1
feature: change device sql for save more detail
hwt75 Jun 21, 2024
d9e1ffc
Merge pull request #418 from techcomrade/feature/device_detail
hwt75 Jun 21, 2024
d64769c
feature: fix bug sql device
hwt75 Jun 21, 2024
b70b206
Merge pull request #419 from techcomrade/feature/device_detail
hwt75 Jun 21, 2024
95ea022
feature: fix bug device sql
hwt75 Jun 21, 2024
ff5f2b3
Merge pull request #420 from techcomrade/feature/device_detail
hwt75 Jun 21, 2024
0d9b9bd
feature: device details
hwt75 Jun 21, 2024
f29796d
Merge pull request #421 from techcomrade/feature/device_detail
hwt75 Jun 21, 2024
41938f0
improve(back-end): add storage and connection data in get device by i…
DuckDuon175 Jun 21, 2024
73e6b65
Merge pull request #422 from techcomrade/feature/device_api
hwt75 Jun 22, 2024
489f4c2
fix(back-end): fix error reading data file record
Tran-Xuan-Quyen Jun 22, 2024
92432e3
Merge branch 'development' of https://github.com/techcomrade/fmECG in…
Tran-Xuan-Quyen Jun 22, 2024
8da000f
Merge pull request #423 from techcomrade/fix/error_reading_data_file_…
hwt75 Jun 22, 2024
4ad0104
fix(front-end): fix get all register api in register slice
DuckDuon175 Jun 23, 2024
f74e1fd
improve(back-end): format with code prettier
DuckDuon175 Jun 23, 2024
477701f
improve(back-end): add get register by email api
DuckDuon175 Jun 23, 2024
c0508bf
improve(back-end): delete get all registration api in authen, fix reg…
DuckDuon175 Jun 23, 2024
611f507
Merge pull request #425 from techcomrade/feature/register
hwt75 Jun 23, 2024
83f051a
improve(back-end): update proxy for websocket
thaidmfinnick Jun 21, 2024
bf68547
improve(mobile): format code and delete unused files
thaidmfinnick Jun 21, 2024
70f03f7
feature(mobile): model chat
thaidmfinnick Jun 22, 2024
f68c2e5
improve(back-end): update proxy for production
thaidmfinnick Jun 23, 2024
fb40c5e
Merge pull request #426 from techcomrade/issue_122_mobile/integrate_c…
thaidmfinnick Jun 23, 2024
839fb7e
fix(front-end): fix chart display
Huyz109 Jun 23, 2024
1ee2556
Merge pull request #428 from techcomrade/fix/chart
hwt75 Jun 24, 2024
5559d48
fix bug home, chat Gpt
hwt75 Jun 24, 2024
c1b84d6
Merge pull request #429 from techcomrade/fix-bug
hwt75 Jun 24, 2024
ffdc496
fix bug ui device, chat, registers
hwt75 Jun 25, 2024
dab38e1
Merge pull request #431 from techcomrade/fix-bug
hwt75 Jun 25, 2024
6d8b2ab
bug: fix bug device detail
hwt75 Jun 27, 2024
8923950
docker: config for window
hwt75 Jun 27, 2024
c7d74f1
Merge pull request #433 from techcomrade/docker-config
hwt75 Jun 27, 2024
2c0f7cb
Merge pull request #432 from techcomrade/fix-bug
hwt75 Jun 27, 2024
032ac87
gpt conversation feature: tranning, create a new function
hwt75 Jun 28, 2024
3c7222f
resolved conflict merged
hwt75 Jun 28, 2024
70a155d
feature: improve AI
hwt75 Jun 28, 2024
be4ff71
GPT feature: improve action
hwt75 Jun 28, 2024
ff1ddde
gpt ai: ỉmpove feature ai
hwt75 Jun 28, 2024
a8549ca
Merge pull request #435 from techcomrade/gpt-conversation
hwt75 Jun 28, 2024
766a41c
fix bug: covnert string
hwt75 Jun 28, 2024
c32fc7b
Merge pull request #436 from techcomrade/gpt-conversation
hwt75 Jun 28, 2024
7a743d7
feature(mobile): execute external python file
thaidmfinnick Jun 28, 2024
b749de7
fix bug: filter string
hwt75 Jun 28, 2024
04b477d
Merge pull request #438 from techcomrade/gpt-conversation
hwt75 Jun 28, 2024
d35971f
add feature create assitant ai
hwt75 Jun 28, 2024
a0308c4
Merge pull request #439 from techcomrade/gpt-conversation
Huyz109 Jun 30, 2024
9f3a6d3
feature(mobile): add bluetooth classic ang draw chart
thaidmfinnick Jun 30, 2024
b6f6e92
Merge pull request #437 from techcomrade/issue_132_mobile/feature_new…
thaidmfinnick Jul 2, 2024
b594998
improve ui
hwt75 Jul 3, 2024
c9ee512
Merge pull request #445 from techcomrade/bug/ui
hwt75 Jul 3, 2024
4e93495
update chat
hwt75 Jul 3, 2024
5bdd484
Merge pull request #446 from techcomrade/bug/ui
hwt75 Jul 3, 2024
aea847c
fix(front-end): fix login/register ui
Huyz109 Jul 5, 2024
9f8f25a
fix(front-end): fix table text
Huyz109 Jul 5, 2024
6e6538e
fix(front-end): fix chat ui
Huyz109 Jul 5, 2024
cbd0e57
Merge pull request #449 from techcomrade/fix/ui
hwt75 Jul 6, 2024
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
11 changes: 7 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@ app:
docker compose -f docker-compose.yml up --build --detach --pull "always"; \
docker image prune -f

# chạy tất cả các services development
dev:
docker compose rm -sf; \
docker compose --profile "*" -f docker-compose-dev.yml up --build --detach; \
docker compose rm -sf && \
docker compose --profile "*" -f docker-compose-dev.yml up --build --detach && \
docker image prune -f

log:
Expand All @@ -29,9 +30,11 @@ chatbash:
chatdb:
docker exec -it database-chat-fmecg sh


# chỉ run các services backend bao gồm db, node, chat (đồng thời run interactive shell của chat)
chatdev:
docker compose rm -sf; \
docker compose --profile backend -f docker-compose-dev.yml up --build --detach; \
docker compose rm -sf && \
docker compose -f docker-compose-back-end.yml up --build --detach && \
docker exec -it chat-fmecg iex -S mix phx.server


82 changes: 82 additions & 0 deletions docker-compose-back-end.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@

services:
node-app:
container_name: node-fmecg
build:
dockerfile: Dockerfile
context: ./server-web
# profiles: ["backend"]
volumes:
- ./server-web/:/server/
- /server/node_modules
depends_on:
- database
env_file: ./server-web/.env.docker
networks:
- network-fmecg

proxy:
container_name: proxy-fmecg
build:
dockerfile: Dockerfile
context: ./proxy
# profiles: ["backend"]
restart: unless-stopped
depends_on:
- node-app
- chat-app
ports:
- 80:80
volumes:
- ./proxy/default_back_end.conf:/etc/nginx/conf.d/default.conf
networks:
- network-fmecg

database:
image: mysql:8.0
container_name: database-fmecg
restart: unless-stopped
# profiles: ["backend"]
ports:
- 3306:3306
expose:
- 3306
env_file: ./server-web/.env.docker
volumes:
- ./docker/data/mysql:/var/lib/mysql
networks:
- network-fmecg

chat-app:
container_name: chat-fmecg
build:
dockerfile: Dockerfile.dev
context: ./server_chat
# profiles: ["backend"]
# command: iex -S mix phx.server
restart: unless-stopped
depends_on:
- database-chat
env_file: ./server_chat/.env.docker
volumes:
- ./server_chat/:/app/
networks:
- network-fmecg

database-chat:
image: postgres:12.19
container_name: database-chat-fmecg
# profiles: ["backend"]
ports:
- 5432:5432
expose:
- 5432
restart: unless-stopped
env_file: ./server_chat/.env.docker
volumes:
- ./docker/data/postgresql:/var/lib/postgresql/data
networks:
- network-fmecg
networks:
network-fmecg:
driver: bridge
1 change: 1 addition & 0 deletions frontend_web/Dockerfile.dev
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ FROM node:20-alpine AS node_builder
WORKDIR /web/

ENV PORT=3002
ENV WATCHPACK_POLLING=true

COPY package.json ./

Expand Down
25 changes: 20 additions & 5 deletions frontend_web/bin/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,15 +59,30 @@ app.post("/login", async (req, res, next) => {
if (result.ok) {
const userInfo = await result.json();
const isDevEnv = config.default_api_url.match("127.0.0.1:3000") != null
res.cookie("user", userInfo.metadata.id);
res.cookie("user", userInfo.metadata.id, {
maxAge: 60000 * userInfo.metadata.expired_time,
httpOnly: false,
});
res.cookie("access_token", userInfo.metadata.access_token, {
maxAge: 60000 * userInfo.metadata.expired_time,
httpOnly: false,
});
res.cookie("refresh_token", userInfo.metadata.refresh_token);
res.cookie("role", userInfo.metadata.role);
res.cookie("api", isDevEnv ? config.default_api_url : `${config.redirect_url}/api`);
res.cookie("redirect_api", isDevEnv ? `http://${config.default_app_host}:${config.default_app_port}/login` : `${config.redirect_url}/login`);
res.cookie("refresh_token", userInfo.metadata.refresh_token, {
maxAge: 60000 * userInfo.metadata.expired_time,
httpOnly: false,
});
res.cookie("role", userInfo.metadata.role, {
maxAge: 60000 * userInfo.metadata.expired_time,
httpOnly: false,
});
res.cookie("api", isDevEnv ? config.default_api_url : `${config.redirect_url}/api`, {
maxAge: 60000 * userInfo.metadata.expired_time,
httpOnly: false,
});
res.cookie("redirect_api", isDevEnv ? `http://${config.default_app_host}:${config.default_app_port}/login` : `${config.redirect_url}/login`, {
maxAge: 60000 * userInfo.metadata.expired_time,
httpOnly: false,
});
return res.status(200).json("login successfully");
}
return res.status(400).json("login failed");
Expand Down
67 changes: 33 additions & 34 deletions frontend_web/bin/views/index.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
<style>

:root {
--primary-color: #4ea685;
--secondary-color: #57b894;
--primary-color: #579cfd;
--secondary-color: #62ace4;
--black: #000000;
--white: #ffffff;
--gray: #efefef;
Expand All @@ -25,7 +25,7 @@
@import url("https://fonts.googleapis.com/css2?family=Poppins:wght@200;300;400;500;600&display=swap");

* {
font-family: "Poppins", sans-serif;
font-family: sans-serif;
margin: 0;
box-sizing: border-box;
}
Expand Down Expand Up @@ -377,8 +377,8 @@ select {
<div class="form sign-up sign-up-form">
<div class="input-group">
<i class="bx bxs-user"></i>
<label for="username-label">Username </label>
<input type="text" placeholder="Username" id="sign-up-username" class="sign-up-input" required />
<label for="username-label">Họ và tên </label>
<input type="text" placeholder="Họ và tên" id="sign-up-username" class="sign-up-input" required />
</div>
<div class="input-group">
<i class="bx bx-mail-send"></i>
Expand All @@ -387,54 +387,53 @@ select {
</div>
<div class="input-group">
<i class="bx bxs-lock-alt"></i>
<label for="passwor-label">Password </label>
<input type="password" placeholder="Password" id="sign-up-password" class="sign-up-input" required />
<label for="passwor-label">Mật khẩu </label>
<input type="password" placeholder="Mật khẩu" id="sign-up-password" class="sign-up-input" required />
<i class="fa-solid fa-eye" id="show-password"></i>
</div>
<div class="input-group">
<i class="bx bxs-lock-alt"></i>
<label for="cf-password-label">Confirm Password </label>
<input type="password" placeholder="Confirm Password" id="confirm-password" class="sign-up-input" required />
<label for="cf-password-label">Xác nhận mật khẩu </label>
<input type="password" placeholder="Xác nhận mật khẩu" id="confirm-password" class="sign-up-input" required />
<i class="fa-solid fa-eye" id="show-confirm-password"></i>
</div>
<div class="input-group">
<i class="bx bxs-gender"></i>
<label for="gender-label">Gender </label>
<label for="gender-label">Giới tính </label>
<select id="sign-up-gender">
<option value="">Choose a gender</option>
<option value="0">Male</option>
<option value="1">Female</option>
<option value="">Chọn giới tính</option>
<option value="0">Nam</option>
<option value="1">Nữ</option>
</select>
</div>
<div class="input-group">
<i class="bx bxs-role"></i>
<label for="role-label">Role </label>
<label for="role-label">Chức vụ </label>
<select id="sign-up-role" required>
<option value="">Choose a role</option>
<option value="0">Admin</option>
<option value="1">Doctor</option>
<option value="2">Patient</option>
<option value="">Chọn chức vụ</option>
<option value="1">Bác sĩ</option>
<option value="2">Bệnh nhân</option>
</select>
</div>
<div class="input-group">
<i class="bx bxs-birth"></i>
<label for="birthday-label">Date of birth </label>
<label for="birthday-label">Ngày sinh </label>
<input type="date" id="sign-up-birth" class="sign-up-input" required/>
</div>
<div class="input-group">
<i class="bx bxs-phone"></i>
<label for="phone-number-label">Phone Number </label>
<input type="text" placeholder="Phone Number" class="sign-up-input" id="sign-up-phone-number" />
<label for="phone-number-label">Số điện thoại </label>
<input type="text" placeholder="Số điện thoại" class="sign-up-input" id="sign-up-phone-number" />
</div>
<div class="input-group">
<i class="bx bx-info"></i>
<label for="info-label">User information</label>
<input type="text" placeholder="User information" id="sign-up-info" class="sign-up-input" required />
<label for="info-label">Thông tin người dùng</label>
<input type="text" placeholder="Thông tin người dùng" id="sign-up-info" class="sign-up-input" required />
</div>
<button onclick="signupFunction()" >Sign up</button>
<button onclick="signupFunction()" >Đăng ký</button>
<p class="align-center">
<span> Already have an account? </span>
<b onclick="toggle()" class="pointer"> Sign in here </b>
<span> Bạn đã có tài khoản? </span>
<b onclick="toggle()" class="pointer"> Đâng nhập tại đây </b>
</p>
</div>
</div>
Expand All @@ -446,32 +445,32 @@ select {
<div class="form sign-in">
<div class="input-group">
<i class="bx bxs-user"></i>
<label for="username-login">Username</label>
<label for="username-login">Tên đăng nhập</label>
<input
type="text"
placeholder="Username"
placeholder="Tên đăng nhập"
id="input-user-name"
class="sign-in-input"
/>
</div>
<div class="input-group">
<i class="bx bxs-lock-alt"></i>
<label for="password-login">Password</label>
<label for="password-login">Mật khẩu</label>
<input
type="password"
placeholder="Password"
placeholder="Mật khẩu"
id="input-password"
class="sign-in-input"
/>
<i class="fa-solid fa-eye" id="show-password-sign-in"></i>
</div>
<button onclick="loginFunction()">Sign in</button>
<button onclick="loginFunction()">Đăng nhập</button>
<p class="align-center">
<b> Forgot password? </b>
<b> Quên mật khẩu? </b>
</p>
<p class="align-center">
<span> Don't have an account? </span>
<b onclick="toggle()" class="pointer"> Sign up here </b>
<span> Bạn chưa có tài khoản? </span>
<b onclick="toggle()" class="pointer"> Đăng ký tại đây </b>
</p>
</div>
</div>
Expand Down
2 changes: 2 additions & 0 deletions frontend_web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"version": "0.1.0",
"private": true,
"dependencies": {
"@ant-design/icons": "^5.3.7",
"@fortawesome/fontawesome-svg-core": "^6.4.0",
"@reduxjs/toolkit": "^1.9.7",
"@testing-library/jest-dom": "^5.16.5",
Expand All @@ -14,6 +15,7 @@
"chartjs-plugin-zoom": "^2.0.1",
"dayjs": "^1.11.10",
"react": "^18.2.0",
"react-apexcharts": "^1.4.1",
"react-chartjs-2": "^5.2.0",
"react-cookie": "^7.1.0",
"react-dom": "^18.2.0",
Expand Down
Binary file added frontend_web/public/ai.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added frontend_web/public/avatar.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
22 changes: 17 additions & 5 deletions frontend_web/public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,7 @@
<link rel="icon" href="%PUBLIC_URL%/favicon.ico" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="theme-color" content="#000000" />
<meta
name="description"
content="ECG admin website"
/>
<meta name="description" content="ECG admin website" />
<link rel="apple-touch-icon" href="%PUBLIC_URL%/logo192.png" />
<!--
manifest.json provides metadata used when your web app is installed on a
Expand Down Expand Up @@ -53,29 +50,44 @@
refresh_token: "",
user_id: "",
};

const access_token = getCookie("access_token");
if (access_token) {
localStorage.setItem("user", getCookie("user"));
localStorage.setItem("access_token", getCookie("access_token"));
localStorage.setItem("refresh_token", getCookie("refresh_token"));
localStorage.setItem("api", decodeURIComponent(getCookie("api")));
localStorage.setItem("role", getCookie("role"));
localStorage.setItem("redirect_api",decodeURIComponent(getCookie("redirect_api")))
localStorage.setItem(
"redirect_api",
decodeURIComponent(getCookie("redirect_api"))
);
cookieData = {
access_token: localStorage.getItem("access_token"),
refresh_token: localStorage.getItem("refresh_token"),
user_id: localStorage.getItem("user"),
role: localStorage.getItem("role"),
api: localStorage.getItem("api"),
};
console.log("hi");

} else {
console.log("hi");
cookieData = {
access_token: "",
refresh_token: "",
user_id: "",
api: "",
};
var url = window.location.host;
localStorage.clear();
window.location.href = "http://127.0.0.1:3001/login";

if (url !== "127.0.0.1:3002") {
window.location.href = "/login";
} else {
window.location.href = "http://127.0.0.1:3001/login";
}
}
// Set a global variable to indicate whether the cookie exists
window.hasCookie = cookieData;
Expand Down
Binary file added frontend_web/public/user.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading