mirror of
https://github.com/linux-odyssey/linux-odyssey.git
synced 2026-11-08 03:20:12 +08:00
refactor: move interfaces to types.ts
This commit is contained in:
1 parent
7f33100132
commit
bb2a1a145f
3 files changed
+18
-15
No files matched your search
@@ -2,12 +2,7 @@
|
|||||||
import { computed } from 'vue'
|
import { computed } from 'vue'
|
||||||
import MarkdownText from './MarkdownText.vue'
|
import MarkdownText from './MarkdownText.vue'
|
||||||
import sessionStore from '../store/session'
|
import sessionStore from '../store/session'
|
||||||
|
import { Task } from '../types'
|
||||||
interface Task {
|
|
||||||
id: number
|
|
||||||
name: string
|
|
||||||
completed: boolean
|
|
||||||
}
|
|
||||||
|
|
||||||
const tasks = computed(() => {
|
const tasks = computed(() => {
|
||||||
return sessionStore.session.tasks.map((task: Task) => {
|
return sessionStore.session.tasks.map((task: Task) => {
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import api from '../utils/api'
|
|||||||
import Socket from '../utils/socket'
|
import Socket from '../utils/socket'
|
||||||
import SocketTerminal from '../utils/terminal'
|
import SocketTerminal from '../utils/terminal'
|
||||||
import { LoadQuestError, LoadSessionError } from '../utils/errors'
|
import { LoadQuestError, LoadSessionError } from '../utils/errors'
|
||||||
|
import { Session } from '../types'
|
||||||
|
|
||||||
const toast = useToast()
|
const toast = useToast()
|
||||||
|
|
||||||
@@ -26,21 +27,13 @@ function newSession() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
interface Session {
|
|
||||||
status: string
|
|
||||||
graph: FileGraph
|
|
||||||
pwd: string
|
|
||||||
hints: string[]
|
|
||||||
tasks: string[]
|
|
||||||
}
|
|
||||||
|
|
||||||
interface Store {
|
interface Store {
|
||||||
session: Session
|
session: Session
|
||||||
questId: string
|
questId: string
|
||||||
quest: IQuest | null
|
quest: IQuest | null
|
||||||
}
|
}
|
||||||
|
|
||||||
const store: Store = reactive({
|
const store = reactive<Store>({
|
||||||
session: newSession(),
|
session: newSession(),
|
||||||
questId: '',
|
questId: '',
|
||||||
quest: null,
|
quest: null,
|
||||||
|
|||||||
@@ -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[]
|
||||||
|
}
|
||||||
Reference in new issue
Block a user