refactor: move interfaces to types.ts

This commit is contained in:
wancat committed 2024-03-28 20:55:40 +08:00
1 parent 7f33100132
commit bb2a1a145f
3 files changed
+18 -15

No files matched your search

+1 -6
View File
@@ -2,12 +2,7 @@
import { computed } from 'vue'
import MarkdownText from './MarkdownText.vue'
import sessionStore from '../store/session'
interface Task {
id: number
name: string
completed: boolean
}
import { Task } from '../types'
const tasks = computed(() => {
return sessionStore.session.tasks.map((task: Task) => {
+2 -9
View File
@@ -7,6 +7,7 @@ import api from '../utils/api'
import Socket from '../utils/socket'
import SocketTerminal from '../utils/terminal'
import { LoadQuestError, LoadSessionError } from '../utils/errors'
import { Session } from '../types'
const toast = useToast()
@@ -26,21 +27,13 @@ function newSession() {
}
}
interface Session {
status: string
graph: FileGraph
pwd: string
hints: string[]
tasks: string[]
}
interface Store {
session: Session
questId: string
quest: IQuest | null
}
const store: Store = reactive({
const store = reactive<Store>({
session: newSession(),
questId: '',
quest: null,
+15
View File
@@ -0,0 +1,15 @@
import { FileGraph } from '@linux-odyssey/file-graph'
export interface Task {
id: number
name: string
completed: boolean
}
export interface Session {
status: string
graph: FileGraph
pwd: string
hints: string[]
tasks: Task[]
}