-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
update driver api #232
update driver api #232
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
error
Throws an error with a HTTP status code and an optional message. When called during request handling, this will cause SvelteKit to return an error response without invoking handleError. Make sure you’re not catching the thrown error, which would prevent SvelteKit from handling it.
https://svelte.dev/docs/kit/@sveltejs-kit#error
|
||
return json({ success: true }); | ||
if (result.numUpdatedRows === BigInt(0)) { | ||
throw error(404, 'Not found'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
??
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
error
Throws an error with a HTTP status code and an optional message. When called during request handling, this will cause SvelteKit to return an error response without invoking handleError. Make sure you’re not catching the thrown error, which would prevent SvelteKit from handling it.
https://svelte.dev/docs/kit/@sveltejs-kit#error
|
||
export const GET = async ({ locals, url }) => { | ||
const companyId = locals.session!.companyId!; | ||
const fromTime = readInt(url.searchParams.get('fromTime')); | ||
const toTime = readInt(url.searchParams.get('toTime')); | ||
|
||
if (isNaN(fromTime) || isNaN(toTime)) { | ||
throw error(400, 'Bad request'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const requestId = readInt(url.searchParams.get('requestId')); | ||
const ticketCode = url.searchParams.get('ticketCode'); | ||
|
||
if (typeof ticketCode !== 'string' || isNaN(requestId)) { | ||
throw 'bad params'; | ||
throw error(400, 'Bad request'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
|
||
return json({ success: true }); | ||
if (result.numUpdatedRows === BigInt(0)) { | ||
throw error(404, 'Not found'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No description provided.