@@ -1,6 +1,4 @@
|
|||||||
import { getAILoginSummary } from "oj/api"
|
import { getAILoginSummary } from "oj/api"
|
||||||
import { STORAGE_KEY } from "utils/constants"
|
|
||||||
import storage from "utils/storage"
|
|
||||||
|
|
||||||
interface LoginSummary {
|
interface LoginSummary {
|
||||||
start: string
|
start: string
|
||||||
@@ -19,14 +17,6 @@ export const useLoginSummaryStore = defineStore("loginSummary", () => {
|
|||||||
const analysis = ref("")
|
const analysis = ref("")
|
||||||
const analysisError = ref("")
|
const analysisError = ref("")
|
||||||
|
|
||||||
function getTodayKey() {
|
|
||||||
const now = new Date()
|
|
||||||
const year = now.getFullYear()
|
|
||||||
const month = String(now.getMonth() + 1).padStart(2, "0")
|
|
||||||
const day = String(now.getDate()).padStart(2, "0")
|
|
||||||
return `${year}-${month}-${day}`
|
|
||||||
}
|
|
||||||
|
|
||||||
async function fetchSummary() {
|
async function fetchSummary() {
|
||||||
loading.value = true
|
loading.value = true
|
||||||
analysis.value = ""
|
analysis.value = ""
|
||||||
@@ -44,12 +34,6 @@ export const useLoginSummaryStore = defineStore("loginSummary", () => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async function open() {
|
async function open() {
|
||||||
const today = getTodayKey()
|
|
||||||
const lastShown = storage.get(STORAGE_KEY.LOGIN_SUMMARY_LAST_SHOWN)
|
|
||||||
if (lastShown === today) {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
storage.set(STORAGE_KEY.LOGIN_SUMMARY_LAST_SHOWN, today)
|
|
||||||
show.value = true
|
show.value = true
|
||||||
await fetchSummary()
|
await fetchSummary()
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -130,7 +130,6 @@ export const STORAGE_KEY = {
|
|||||||
LEARN_CURRENT_STEP: "learnStep",
|
LEARN_CURRENT_STEP: "learnStep",
|
||||||
ADMIN_PROBLEM: "adminProblem",
|
ADMIN_PROBLEM: "adminProblem",
|
||||||
ADMIN_PROBLEM_TAGS: "adminProblemTags",
|
ADMIN_PROBLEM_TAGS: "adminProblemTags",
|
||||||
LOGIN_SUMMARY_LAST_SHOWN: "login-summary-last-shown",
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export const DIFFICULTY = {
|
export const DIFFICULTY = {
|
||||||
|
|||||||
Reference in New Issue
Block a user