diff --git a/app/src/components/QuestPart.vue b/app/src/components/QuestPart.vue index f4cae70..0e567be 100644 --- a/app/src/components/QuestPart.vue +++ b/app/src/components/QuestPart.vue @@ -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) => { diff --git a/app/src/store/session.ts b/app/src/store/session.ts index 66946e1..1223f88 100644 --- a/app/src/store/session.ts +++ b/app/src/store/session.ts @@ -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({ session: newSession(), questId: '', quest: null, diff --git a/app/src/types.ts b/app/src/types.ts new file mode 100644 index 0000000..853ef95 --- /dev/null +++ b/app/src/types.ts @@ -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[] +}