Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Disabled create CRUD button if not logged in #228

Merged
merged 3 commits into from
Feb 22, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions packages/vue/src/components/SpCrud/SpCrud.vue
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
</SpTypography>
</div>
<div class="col-6 text-align--right">
<SpButton type="primary" @click="visibleModal = 'create-item'">
<SpButton type="primary" :disabled='!address' @click="visibleModal = 'create-item'">
Create post
</SpButton>
</div>
Expand Down Expand Up @@ -62,6 +62,7 @@
import { defineComponent, reactive, toRefs } from 'vue'
import { useStore } from 'vuex'

import { useAddress } from '../../composables'
import SpButton from '../SpButton'
import SpCrudCreate from '../SpCrudCreate'
import SpCrudDelete from '../SpCrudDelete'
Expand Down Expand Up @@ -115,13 +116,17 @@ export default defineComponent({
// store
let $s = useStore()

// composables
let { address } = useAddress({ $s })

// state
let state: State = reactive(initialState)

state.moduleAvailable = $s.hasModule(props.storeName)

return {
...toRefs(state)
...toRefs(state),
address
}
}
})
Expand Down