toast messages logging in and out
Massimo Melina committed
Jun 6, 2024 at 15:54 UTC
8a2b25455d689636536243e816b850c5a2398aef
3 files changed
+9
-3
frontend/src/login.ts
+3
-1
@@ -2,7 +2,7 @@
2
3
import { apiCall } from '@hfs/shared/api'
4
import { state, useSnapState } from './state'
5
-import { alertDialog, newDialog } from './dialog'
5
+import { alertDialog, newDialog, toast } from './dialog'
6
import { getHFS, hIcon, makeSessionRefresher, srpClientSequence, working,
7
HTTP_CONFLICT, HTTP_UNAUTHORIZED,} from './misc'
8
import { createElement as h, Fragment, useEffect, useRef } from 'react'
@@ -36,6 +36,7 @@ export function logout(){
36
throw res
37
state.username = ''
38
reloadList()
39
+ toast(t`Logged out`, 'success')
40
})
41
}
42
@@ -113,6 +114,7 @@ export async function loginDialog(closable=false) {
114
try {
115
const res = await login(usr, pwd)
116
close(true)
117
+ toast(t`Logged in`, 'success')
118
if (res?.redirect)
119
setTimeout(() => // workaround: the history.back() issued by closing the dialog is messing with our navigation
120
getHFS().navigate(res.redirect), 10) // from my tests 1 was enough, 0 was not (not always). Would be nice to find a cleaner way
src/langs/hfs-lang-en.json
+3
-1
@@ -169,6 +169,8 @@
169
"to_clipboard_source_tooltip": "Go to the folder where the clipboard contents are located",
170
"more_items": "{n} more item(s)",
171
"Show details": "Show details",
172
- "upload_conflict": "already exists"
172
+ "upload_conflict": "already exists",
173
+ "Logged in": "Logged in",
174
+ "Logged out": "Logged out"
175
}
176
}
src/langs/hfs-lang-it.json
+3
-1
@@ -161,6 +161,8 @@
161
"to_clipboard_source_tooltip": "Vai alla cartella d'origine dei file negli appunti",
162
"more_items": "{n,plural,one{Un altro elemento} other{# altri elementi}}",
163
"Show details": "Mostra dettagli",
164
- "upload_conflict": "esiste già"
164
+ "upload_conflict": "esiste già",
165
+ "Logged in": "Benvenuto",
166
+ "Logged out": "Arrivederci"
167
}
168
}