Skip to content

Commit

Permalink
feat: add init app
Browse files Browse the repository at this point in the history
  • Loading branch information
antonreshetov committed Mar 25, 2022
1 parent b0547e2 commit 5e4de2a
Showing 1 changed file with 19 additions and 17 deletions.
36 changes: 19 additions & 17 deletions src/renderer/views/Main.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,29 +2,31 @@
<div class="main">
<TheSidebar />
<SnippetList />
<TheEditor
v-model="snippet"
v-model:lang="lang"
/>
<SnippetsView />
</div>
</template>

<script setup lang="ts">
import { ref } from 'vue'
import { store } from '@/electron'
import { useFolderStore } from '@/store/folders'
import { useSnippetStore } from '@/store/snippets'
const snippet = ref(
`declare module '*.vue' {
import type { DefineComponent } from 'vue'
// eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/ban-types
const component: DefineComponent<{}, {}, any>
export default component
};
const folderStore = useFolderStore()
const snippetStore = useSnippetStore()
const x = 1
let a = 'some'
`
)
const lang = ref()
const init = async () => {
const storedFolderId = store.app.get('selectedFolderId')
const storedSnippetId = store.app.get('selectedSnippetId')
const firstFolderId = folderStore.main[0]?.id
const firstSnippetId = snippetStore.snippets[0]?.id
await folderStore.getFolders()
folderStore.selectId(storedFolderId || firstFolderId)
await snippetStore.getSnippetsByFolderId(storedFolderId || firstFolderId)
await snippetStore.getSnippetsById(storedSnippetId || firstSnippetId)
}
init()
</script>

<style scoped lang="scss">
Expand Down

0 comments on commit 5e4de2a

Please sign in to comment.