Version moderation

This commit is contained in:
Geometrically
2021-01-11 14:01:56 -07:00
parent 937b00cfcc
commit 5e8bcf8faf

View File

@@ -38,6 +38,17 @@
<div class="section-header"> <div class="section-header">
<h3 class="column-grow-1">Versions</h3> <h3 class="column-grow-1">Versions</h3>
</div> </div>
<div v-for="version in versions" :key="version.id" class="version columns">
<div class="text">
<nuxt-link :to="`/mod/${version.mod_id}/version/${version.id}`">
Version <strong>{{ version.name }}</strong>
</nuxt-link>
</div>
<div class="actions">
<button>Reject</button>
<button @click="changeVersionStatus(version.id)">Accept</button>
</div>
</div>
</DashboardPage> </DashboardPage>
</template> </template>
@@ -98,6 +109,26 @@ export default {
await this.$router.go(0) await this.$router.go(0)
}, },
async changeVersionStatus(id) {
const config = {
headers: {
Authorization: this.$auth.getToken('local')
? this.$auth.getToken('local')
: '',
},
}
await axios.patch(
`https://api.modrinth.com/api/v1/version/${id}`,
{
accepted: true,
},
config
)
await this.$router.go(0)
},
}, },
} }
</script> </script>
@@ -106,4 +137,16 @@ export default {
.button { .button {
margin: 0.25rem 0; margin: 0.25rem 0;
} }
.version {
@extend %card;
padding: var(--spacing-card-sm) var(--spacing-card-lg);
margin-bottom: var(--spacing-card-sm);
align-items: center;
justify-content: space-between;
p {
margin: 0;
}
}
</style> </style>