Skip to content

Commit f2b2ef2

Browse files
committed
fix: repeated login when click login btn too fast
1 parent 593803d commit f2b2ef2

File tree

3 files changed

+259
-207
lines changed

3 files changed

+259
-207
lines changed

frontend/package.json

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@
1414
"@ant-design/icons-vue": "^6.1.0",
1515
"ant-design-vue": "^3.2.15",
1616
"apexcharts": "^3.36.3",
17-
"axios": "^1.1.3",
18-
"dayjs": "^1.11.6",
19-
"pinia": "^2.0.23",
20-
"pinia-plugin-persistedstate": "^2.3.0",
17+
"axios": "^1.2.2",
18+
"dayjs": "^1.11.7",
19+
"pinia": "^2.0.28",
20+
"pinia-plugin-persistedstate": "^3.0.2",
2121
"reconnecting-websocket": "^4.4.0",
2222
"vite-plugin-build-id": "^0.2.2",
2323
"vue": "^3.2.45",
@@ -33,14 +33,14 @@
3333
"@types/sortablejs": "^1.15.0"
3434
},
3535
"devDependencies": {
36-
"@vitejs/plugin-vue": "^3.2.0",
37-
"@vitejs/plugin-vue-jsx": "^2.1.1",
38-
"@zougt/vite-plugin-theme-preprocessor": "^1.4.5",
36+
"@vitejs/plugin-vue": "^4.0.0",
37+
"@vitejs/plugin-vue-jsx": "^3.0.0",
38+
"@zougt/vite-plugin-theme-preprocessor": "^1.4.8",
3939
"less": "^4.1.3",
40-
"typescript": "^4.6.4",
41-
"unplugin-vue-components": "^0.22.9",
42-
"vite": "^4.0.3",
40+
"typescript": "^4.9.4",
41+
"unplugin-vue-components": "^0.22.12",
42+
"vite": "^4.0.4",
4343
"vite-plugin-html": "^3.2.0",
44-
"vue-tsc": "^1.0.9"
44+
"vue-tsc": "^1.0.22"
4545
}
4646
}

frontend/src/views/other/Login.vue

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,29 +32,30 @@ const rulesRef = reactive({
3232
username: [
3333
{
3434
required: true,
35-
message: () => $gettext('Please input your username!'),
35+
message: () => $gettext('Please input your username!')
3636
}
3737
],
3838
password: [
3939
{
4040
required: true,
41-
message: () => $gettext('Please input your password!'),
41+
message: () => $gettext('Please input your password!')
4242
}
4343
]
4444
})
4545
4646
const {validate, validateInfos, clearValidate} = Form.useForm(modelRef, rulesRef)
4747
4848
const onSubmit = () => {
49-
validate().then(() => {
50-
// modelRef
51-
auth.login(modelRef.username, modelRef.password).then(async () => {
49+
validate().then(async () => {
50+
loading.value = true
51+
await auth.login(modelRef.username, modelRef.password).then(async () => {
5252
message.success($gettext('Login successful'), 1)
5353
const next = (route.query?.next || '').toString() || '/'
5454
await router.push(next)
5555
}).catch(e => {
5656
message.error($gettext(e.message ?? 'Server error'))
5757
})
58+
loading.value = false
5859
})
5960
}
6061

0 commit comments

Comments
 (0)