status -> statusCode
This commit is contained in:
@@ -9,9 +9,9 @@ export default defineEventHandler(async (event) => {
|
|||||||
|
|
||||||
const userId = session.secure?.user_id;
|
const userId = session.secure?.user_id;
|
||||||
if (userId == undefined || userId == null)
|
if (userId == undefined || userId == null)
|
||||||
throw createError({ status: 401 })
|
throw createError({ statusCode: 401 })
|
||||||
else if (body.song == undefined)
|
else if (body.song == undefined)
|
||||||
throw createError({ status: 400, message: "Song name required"})
|
throw createError({ statusCode: 400, statusMessage: "Song name required"})
|
||||||
|
|
||||||
const req = await fetch(config.fastapi_url + "/convert", {
|
const req = await fetch(config.fastapi_url + "/convert", {
|
||||||
method: "POST",
|
method: "POST",
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ export default defineEventHandler(async (event) => {
|
|||||||
//console.log(is_https)
|
//console.log(is_https)
|
||||||
|
|
||||||
if ( !body.email || !body.password )
|
if ( !body.email || !body.password )
|
||||||
throw createError({ statusCode: 400, message: "Bad form. Use e-mail and password" })
|
throw createError({ statusCode: 400, statusMessage: "Bad form. Use e-mail and password" })
|
||||||
//console.log(body)
|
//console.log(body)
|
||||||
const req = await fetch(conf.fastapi_url + "/login",
|
const req = await fetch(conf.fastapi_url + "/login",
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ export default defineEventHandler(async (event) => {
|
|||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
const userId = session.secure?.user_id;
|
const userId = session.secure?.user_id;
|
||||||
if (userId == undefined || userId == null)
|
if (userId == undefined || userId == null)
|
||||||
throw createError({ status: 401 })
|
throw createError({ statusCode: 401 })
|
||||||
|
|
||||||
const r = await fetch(config.fastapi_url + "/me" + '?' +
|
const r = await fetch(config.fastapi_url + "/me" + '?' +
|
||||||
new URLSearchParams({ id: userId }))
|
new URLSearchParams({ id: userId }))
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ export default defineEventHandler(async (event) => {
|
|||||||
|
|
||||||
const body = await readBody(event)
|
const body = await readBody(event)
|
||||||
if (body.new_pw !== body.confirm_new_pw)
|
if (body.new_pw !== body.confirm_new_pw)
|
||||||
throw createError({status:400, message: "Passwords don't match!"})
|
throw createError({statusCode: 400, statusMessage: "Passwords don't match!"})
|
||||||
|
|
||||||
const session = await getUserSession(event)
|
const session = await getUserSession(event)
|
||||||
const config = await useRuntimeConfig(event)
|
const config = await useRuntimeConfig(event)
|
||||||
@@ -35,7 +35,7 @@ export default defineEventHandler(async (event) => {
|
|||||||
new URLSearchParams({ id: userId }))
|
new URLSearchParams({ id: userId }))
|
||||||
if (!current_r.ok)
|
if (!current_r.ok)
|
||||||
if (current_r.status == 404)
|
if (current_r.status == 404)
|
||||||
throw createError({status: 404, message: "User doesn't exist"})
|
throw createError({statusCode: 404, statusMessage: "User doesn't exist"})
|
||||||
|
|
||||||
await $fetch(config.fastapi_url + "/changepw", {
|
await $fetch(config.fastapi_url + "/changepw", {
|
||||||
method: "POST",
|
method: "POST",
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ export default defineEventHandler(async (event) => {
|
|||||||
|
|
||||||
if (!current_r.ok)
|
if (!current_r.ok)
|
||||||
if (current_r.status == 404)
|
if (current_r.status == 404)
|
||||||
throw createError({ status: 404, message: "User not found"})
|
throw createError({ statusCode: 404, statusMessage: "User not found"})
|
||||||
|
|
||||||
|
|
||||||
const current_body = await current_r.json();
|
const current_body = await current_r.json();
|
||||||
|
|||||||
Reference in New Issue
Block a user