Skip to content
This repository has been archived by the owner on Jan 21, 2024. It is now read-only.

feat: add buttons that update journal type directly #610

Merged
merged 1 commit into from Sep 13, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
22 changes: 20 additions & 2 deletions src/views/sheet/independent/JournalList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,16 @@
<a-icon type="message" />
{{ item.commentCount }}
</a-button>
<a-button v-if="item.type === 'INTIMATE'" class="!p-0" disabled type="link">
<a-button
v-if="item.type === 'INTIMATE'"
class="!p-0"
type="link"
@click="handleJournalTypeUpdate(item)"
style="color: grey"
>
<a-icon type="lock" />
</a-button>
<a-button v-else class="!p-0" type="link">
<a-button v-else class="!p-0" type="link" @click="handleJournalTypeUpdate(item)">
<a-icon type="unlock" />
</a-button>
</template>
Expand Down Expand Up @@ -321,6 +327,18 @@ export default {
this.form.model.content = renderContent
},

handleJournalTypeUpdate(item) {
this.form.model = deepClone(item)
this.form.model.type = item.type === 'PUBLIC' ? 'INTIMATE' : 'PUBLIC'
apiClient.journal
.update(this.form.model.id, this.form.model)
.catch(e => {
this.$log.error(e)
})
.finally(() => {
this.handleListJournals()
})
},
handleSaveOrUpdate() {
const _this = this
_this.$refs.journalForm.validate(valid => {
Expand Down