File tree Expand file tree Collapse file tree 2 files changed +18
-1
lines changed Expand file tree Collapse file tree 2 files changed +18
-1
lines changed Original file line number Diff line number Diff line change @@ -5,7 +5,6 @@ import type { $Fetch } from 'nitropack/types';
5
5
6
6
declare module '#app' {
7
7
interface NuxtApp {
8
- $storage ( msg : string ) : string ;
9
8
$http < T = unknown > (
10
9
request : NitroFetchRequest ,
11
10
opts ?: HttpFetchOptions
Original file line number Diff line number Diff line change
1
+ import type { NitroFetchRequest } from 'nitropack/types' ;
2
+ import type { HttpFetchOptions } from '~' ;
3
+
4
+ export function $http < T = unknown > ( request : NitroFetchRequest , opts ?: HttpFetchOptions ) : Promise < T > {
5
+ const { $http : http } = useNuxtApp ( ) ;
6
+
7
+ return http ( request , opts ) ;
8
+ }
9
+
10
+ export function $storage ( path : string ) : string {
11
+ if ( ! path ) return '' ;
12
+
13
+ const config = useRuntimeConfig ( ) ;
14
+
15
+ return path . startsWith ( 'http://' ) || path . startsWith ( 'https://' )
16
+ ? path
17
+ : config . public . storageBase + path ;
18
+ }
You can’t perform that action at this time.
0 commit comments