diff --git a/web/src/helpers/consts.ts b/web/src/helpers/consts.ts deleted file mode 100644 index 4edfce2..0000000 --- a/web/src/helpers/consts.ts +++ /dev/null @@ -1,8 +0,0 @@ -// UNKNOWN_ID is the symbol for unknown id -export const UNKNOWN_ID = -1; - -// default animation duration -export const ANIMATION_DURATION = 200; - -// millisecond in a day -export const DAILY_TIMESTAMP = 3600 * 24 * 1000; diff --git a/web/src/helpers/storage.ts b/web/src/helpers/storage.ts deleted file mode 100644 index 3dc4a58..0000000 --- a/web/src/helpers/storage.ts +++ /dev/null @@ -1,59 +0,0 @@ -/** - * Define storage data type - */ -interface StorageData { - placeholder: string; -} - -type StorageKey = keyof StorageData; - -/** - * storage helper - */ -export function get(keys: StorageKey[]): Partial { - const data: Partial = {}; - - for (const key of keys) { - try { - const stringifyValue = localStorage.getItem(key); - if (stringifyValue !== null) { - const val = JSON.parse(stringifyValue); - data[key] = val; - } - } catch (error: any) { - console.error("Get storage failed in ", key, error); - } - } - - return data; -} - -export function set(data: Partial) { - for (const key in data) { - try { - const stringifyValue = JSON.stringify(data[key as StorageKey]); - localStorage.setItem(key, stringifyValue); - } catch (error: any) { - console.error("Save storage failed in ", key, error); - } - } -} - -export function remove(keys: StorageKey[]) { - for (const key of keys) { - try { - localStorage.removeItem(key); - } catch (error: any) { - console.error("Remove storage failed in ", key, error); - } - } -} - -export function emitStorageChangedEvent() { - const iframeEl = document.createElement("iframe"); - iframeEl.style.display = "none"; - document.body.appendChild(iframeEl); - - iframeEl.contentWindow?.localStorage.setItem("t", Date.now().toString()); - iframeEl.remove(); -} diff --git a/web/src/services/README.md b/web/src/services/README.md deleted file mode 100644 index bcf4597..0000000 --- a/web/src/services/README.md +++ /dev/null @@ -1,6 +0,0 @@ -# Services - -What should service do? - -- request data api and throw error; -- dispatch state actions; diff --git a/web/src/stores/modules/user.ts b/web/src/stores/modules/user.ts index a02d306..a1e58fc 100644 --- a/web/src/stores/modules/user.ts +++ b/web/src/stores/modules/user.ts @@ -1,7 +1,6 @@ import { createSlice, PayloadAction } from "@reduxjs/toolkit"; interface State { - // user is the user who is currently logged in user?: User; }