File tree 2 files changed +7
-2
lines changed
2 files changed +7
-2
lines changed Original file line number Diff line number Diff line change @@ -7,7 +7,12 @@ export const detect = (app: FastifyInstance) => {
7
7
return async ( request : FastifyRequest < { Querystring : DetectQueries } > , reply : FastifyReply ) => {
8
8
const { latitude, longitude } = request . query
9
9
10
- if ( ! latitude || ! longitude ) {
10
+ if (
11
+ typeof latitude === 'undefined' ||
12
+ latitude . toString ( ) . trim ( ) === '' ||
13
+ typeof longitude === 'undefined' ||
14
+ longitude . toString ( ) . trim ( ) === ''
15
+ ) {
11
16
return sendBadRequest ( reply , "The 'latitude' and 'longitude' parameters is required." )
12
17
}
13
18
Original file line number Diff line number Diff line change @@ -7,7 +7,7 @@ export const search = (app: FastifyInstance) => {
7
7
const { q } = request . query
8
8
// TODO: search by province, regency, or district
9
9
10
- if ( ! q ) {
10
+ if ( typeof q === 'undefined' || q . trim ( ) === '' ) {
11
11
return sendBadRequest ( reply , "The 'q' parameter is required." )
12
12
}
13
13
You can’t perform that action at this time.
0 commit comments