feat: allow associating an existing device ID and token with a username
This commit is contained in:
@@ -69,11 +69,7 @@ app.openapi(route, async (c) => {
|
||||
|
||||
await saveToken(env(c, "workerd"), deviceId, token, username);
|
||||
} catch (error) {
|
||||
// when token already exists in the database
|
||||
if (
|
||||
error.code === "SQLITE_CONSTRAINT" &&
|
||||
error.message.includes("device_tokens.token")
|
||||
) {
|
||||
if (error.message === "Token already exists in the database") {
|
||||
return c.json(ErrorResponse, 412);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user