mirror of
https://github.com/filecoin-project/slate.git
synced 2024-11-09 20:28:29 +03:00
better handling for slate name taken
This commit is contained in:
parent
dbee8e1d82
commit
cfbaaabfd0
@ -66,6 +66,8 @@ export const error = {
|
||||
SERVER_UPDATE_SLATE_MUST_PROVIDE_NAME: "Please provide a slate name",
|
||||
SERVER_UPDATE_SLATE:
|
||||
"We're having trouble updating that slate right now. Please try again later",
|
||||
SERVER_UPDATE_SLATE_NAME_TAKEN:
|
||||
"It looks like that slatename is taken. Please choose another",
|
||||
V1_SERVER_UPLOAD_SLATE_NOT_FOUND:
|
||||
"We're having trouble locating that slate right now. Please try again later",
|
||||
V1_SERVER_API_KEY_NOT_FOUND:
|
||||
|
@ -56,6 +56,16 @@ export default async (req, res) => {
|
||||
});
|
||||
}
|
||||
|
||||
const existingSlate = await Data.getSlateByName({
|
||||
slatename: req.body.data.data.name,
|
||||
});
|
||||
if (existingSlate) {
|
||||
return res.status(500).send({
|
||||
decorator: "SERVER_UPDATE_SLATE_NAME_TAKEN",
|
||||
error: true,
|
||||
});
|
||||
}
|
||||
|
||||
const slate = await Data.updateSlateById({
|
||||
id: response.id,
|
||||
slatename: Strings.createSlug(req.body.data.data.name),
|
||||
|
Loading…
Reference in New Issue
Block a user