Skip to content

Commit

Permalink
feature: add loading to project form
Browse files Browse the repository at this point in the history
  • Loading branch information
abdahmed22 committed Aug 28, 2024
1 parent 1f316b0 commit 125543f
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 12 deletions.
4 changes: 2 additions & 2 deletions client/src/App.vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<template>
<ProjectsView />
<ProjectForm />
</template>

<script lang="ts" setup>
import ProjectsView from './pages/projects/ProjectsView.vue'
import ProjectForm from './components/projects/ProjectForm.vue'
</script>
28 changes: 18 additions & 10 deletions client/src/components/projects/ProjectForm.vue
Original file line number Diff line number Diff line change
Expand Up @@ -37,16 +37,18 @@
:rules="githubRepoRules"
/>

<v-btn
block
class="me-4"
color="blue"
:disabled="!form?.isValid"
text="Submit"
type="submit"
variant="tonal"
@click="createProject"
/>
<v-col class="text-right">
<v-btn
class="me-4"
color="blue"
:disabled="!form?.isValid || loading"
:loading="loading"
size="large"
text="Submit"
type="submit"
@click="createProject"
/>
</v-col>
</v-form>
</template>

Expand All @@ -67,6 +69,8 @@
const form = ref()
const loading = ref(false)
const project = ref<Partial<Project>>(
{
title: '',
Expand All @@ -76,6 +80,7 @@
)
const createProject = async () => {
loading.value = true
let projectObject: Partial<Project> = {
title: project.value.title,
short_description: project.value.short_description,
Expand All @@ -95,6 +100,7 @@
timeout: 7_000,
type: 'success',
})
loading.value = false
})
.catch((err: any) => {
let description = 'Can not create project'
Expand All @@ -108,11 +114,13 @@
timeout: 7_000,
type: 'error',
})
loading.value = false
})
}
return {
form,
loading,
project,
githubRepo,
titleRules,
Expand Down

0 comments on commit 125543f

Please sign in to comment.