Update LoginPage layout for improved spacing and enhance storage utility with new clearAllChainProgress function. Adjust clearAll method to retain workplace number while ensuring all chain progress data is removed upon logout.
Some checks failed
platform/bro-js/challenge-pl/pipeline/head There was a failure building this commit
Some checks failed
platform/bro-js/challenge-pl/pipeline/head There was a failure building this commit
This commit is contained in:
@@ -120,7 +120,7 @@ export const LoginPage = () => {
|
|||||||
</VStack>
|
</VStack>
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
<Box textAlign="center">
|
<Box textAlign="center" mt={120}>
|
||||||
<Text
|
<Text
|
||||||
as="button"
|
as="button"
|
||||||
type="button"
|
type="button"
|
||||||
|
|||||||
@@ -96,14 +96,31 @@ export const storage = {
|
|||||||
localStorage.removeItem(STORAGE_KEYS.SELECTED_TASK_ID)
|
localStorage.removeItem(STORAGE_KEYS.SELECTED_TASK_ID)
|
||||||
},
|
},
|
||||||
|
|
||||||
// Полная очистка при выходе
|
// Полная очистка при выходе (кроме номера рабочего места)
|
||||||
clearAll: (): void => {
|
clearAll: (): void => {
|
||||||
if (!isBrowser()) return
|
if (!isBrowser()) return
|
||||||
localStorage.removeItem(STORAGE_KEYS.USER_ID)
|
localStorage.removeItem(STORAGE_KEYS.USER_ID)
|
||||||
localStorage.removeItem(STORAGE_KEYS.NICKNAME)
|
localStorage.removeItem(STORAGE_KEYS.NICKNAME)
|
||||||
localStorage.removeItem(STORAGE_KEYS.WORKPLACE_NUMBER)
|
// Номер рабочего места НЕ удаляем
|
||||||
localStorage.removeItem(STORAGE_KEYS.SELECTED_CHAIN_ID)
|
localStorage.removeItem(STORAGE_KEYS.SELECTED_CHAIN_ID)
|
||||||
localStorage.removeItem(STORAGE_KEYS.SELECTED_TASK_ID)
|
localStorage.removeItem(STORAGE_KEYS.SELECTED_TASK_ID)
|
||||||
|
|
||||||
|
// Очищаем все прогрессы по цепочкам
|
||||||
|
storage.clearAllChainProgress()
|
||||||
|
},
|
||||||
|
|
||||||
|
// Очистка всех прогрессов по цепочкам
|
||||||
|
clearAllChainProgress: (): void => {
|
||||||
|
if (!isBrowser()) return
|
||||||
|
// Перебираем все ключи localStorage и удаляем те, что начинаются с challengeFurthestTask_
|
||||||
|
const keysToRemove: string[] = []
|
||||||
|
for (let i = 0; i < localStorage.length; i++) {
|
||||||
|
const key = localStorage.key(i)
|
||||||
|
if (key && key.startsWith('challengeFurthestTask_')) {
|
||||||
|
keysToRemove.push(key)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
keysToRemove.forEach(key => localStorage.removeItem(key))
|
||||||
},
|
},
|
||||||
|
|
||||||
// Очистка данных сессии (цепочка, задание) без выхода
|
// Очистка данных сессии (цепочка, задание) без выхода
|
||||||
|
|||||||
Reference in New Issue
Block a user