1
1
import axios from "axios" ;
2
- const AirQuoData = process . env . NEXT_PUBLIC_AIRQUO_DATA
3
- const SUGGESTIONS = process . env . NEXT_PUBLIC_SUGGESTIONS
4
- const SEARCH = process . env . NEXT_PUBLIC_SEARCH
5
2
export const token = process . env . NEXT_PUBLIC_MAP_API_TOKEN
6
3
export const AirQoToken = process . env . NEXT_PUBLIC_AIRQO_DATA_TOKEN
4
+ import { AIRQUO_DATA , MAP_BOX_SUGGESTIONS , MAP_BOX_SEARCH } from "../urls"
7
5
import Node from '@/public/images/map/Node.webp' ;
8
6
import Emoji from '@/public/images/map/Emoji.webp' ;
9
7
import Heatmap from '@/public/images/map/Heatmap.webp' ;
@@ -18,7 +16,7 @@ import StreetsMode from '@/public/images/map/street.webp';
18
16
export const GetAirQuoData = async ( token : string ) => {
19
17
try {
20
18
if ( token ) {
21
- const response = await axios . get ( `${ AirQuoData } ?token=${ token } ` ) ;
19
+ const response = await axios . get ( `${ AIRQUO_DATA } ?token=${ token } ` ) ;
22
20
const data = response . data ;
23
21
return data ;
24
22
}
@@ -43,7 +41,7 @@ export const FetchSuggestions=async(value:string,access_token:string,sessionTok
43
41
if ( latitude !== undefined && longitude !== undefined ) {
44
42
try {
45
43
const proximityParam = `${ longitude } ,${ latitude } ` ;
46
- const response = await axios . get ( `${ SUGGESTIONS } ?q=${ value . toLowerCase ( ) } &access_token=${ access_token } &proximity=${ proximityParam } &session_token=${ sessionToken } ` )
44
+ const response = await axios . get ( `${ MAP_BOX_SUGGESTIONS } ?q=${ value . toLowerCase ( ) } &access_token=${ access_token } &proximity=${ proximityParam } &session_token=${ sessionToken } ` )
47
45
const data = await response . data ;
48
46
49
47
console . log ( "data :" , data . suggestions )
@@ -64,7 +62,7 @@ export const UserClick = async(access_token:string,sessionToken:string,locationi
64
62
return ;
65
63
}
66
64
67
- const response = await axios . get ( ( `${ SEARCH } /${ locationid } ?&access_token=${ access_token } &session_token=${ sessionToken } ` ) )
65
+ const response = await axios . get ( ( `${ MAP_BOX_SEARCH } /${ locationid } ?&access_token=${ access_token } &session_token=${ sessionToken } ` ) )
68
66
const data = response . data ;
69
67
if ( data ) {
70
68
return data ;
@@ -115,7 +113,7 @@ export const mapStyles = [
115
113
export const UserGroups = async ( token : string ) => {
116
114
try {
117
115
if ( token ) {
118
- const response = await axios . get ( `${ AirQuoData } ?token=${ token } ` ) ;
116
+ const response = await axios . get ( `${ AIRQUO_DATA } ?token=${ token } ` ) ;
119
117
const data = response . data ;
120
118
return data ;
121
119
}
0 commit comments