File tree 1 file changed +10
-16
lines changed
1 file changed +10
-16
lines changed Original file line number Diff line number Diff line change 1
- import { $fetch } from "ohmyfetch " ;
2
- import { withQuery } from "ufo" ;
1
+ import { $fetch } from "ofetch " ;
2
+ import { joinURL , withQuery } from "ufo" ;
3
3
import { useLanguages } from "./" ;
4
4
5
5
const cache = new Map ( ) ;
@@ -12,20 +12,14 @@ const cache = new Map();
12
12
*/
13
13
function getApiUrl ( path ) {
14
14
const { isMultilang, languageCode } = useLanguages ( ) ;
15
- let result = "" ;
16
-
17
- // Add language path in multi-language setup
18
- if ( isMultilang ) {
19
- result += `/${ languageCode } ` ;
20
- }
21
-
22
- // Add the API path
23
- result += `/${ import . meta. env . VITE_BACKEND_API_SLUG } ` ;
24
-
25
- // Add the file path
26
- result += `/${ path } ` ;
27
-
28
- return result ;
15
+ return joinURL (
16
+ // Add language path in multi-language setup
17
+ isMultilang ? `/${ languageCode } ` : "" ,
18
+ // Add the API path
19
+ import . meta. env . VITE_BACKEND_API_SLUG ,
20
+ // Add the file path
21
+ path
22
+ ) ;
29
23
}
30
24
31
25
/**
You can’t perform that action at this time.
0 commit comments