1
0
Fork 0

feat(backend/org): Check for existing slugs

This commit is contained in:
Joost De Cock 2023-08-18 13:49:51 +02:00
parent 0e3ba9907d
commit 25ebe0b0db
7 changed files with 146 additions and 11 deletions

View file

@ -298,12 +298,25 @@ Backend.prototype.createIssue = async function (data) {
return responseHandler(await api.post(`/issues`, data), 201)
}
/*
* Check whether a slug is available
*/
Backend.prototype.isSlugAvailable = async function ({ slug, type }) {
const response = await api.get(`/slugs/${type}/${slug}/jwt`, this.auth)
// 404 means username is available, which is success in this case
return response.status === 200
? { success: false, available: false, response }
: { success: true, data: false, available: true, response }
}
/*
* Create showcase Pull Request
*/
Backend.prototype.createShowcasePr = async function (data) {
return responseHandler(await api.post(`/flows/pr/showcase/jwt`, data, this.auth), 201)
}
/*
* Send translation invite
*/