@trackunit/react-core-hooks
Advanced tools
Comparing version 0.2.266 to 0.2.267
@@ -281,3 +281,3 @@ 'use strict'; | ||
const [loading, setLoading] = React.useState(false); | ||
const uploadImage = React.useCallback(({ postUrl, base64Image, type }) => { | ||
const uploadImage = React.useCallback(({ postUrl, base64Image, type, authorize, }) => { | ||
setLoading(true); | ||
@@ -291,5 +291,7 @@ return new Promise((resolve, reject) => { | ||
body: formData, | ||
headers: { | ||
Authorization: `Bearer ${token}`, | ||
}, | ||
headers: authorize | ||
? { | ||
Authorization: `Bearer ${token}`, | ||
} | ||
: {}, | ||
}).then(response => { | ||
@@ -296,0 +298,0 @@ setLoading(false); |
@@ -261,3 +261,3 @@ import * as React from 'react'; | ||
const [loading, setLoading] = useState(false); | ||
const uploadImage = useCallback(({ postUrl, base64Image, type }) => { | ||
const uploadImage = useCallback(({ postUrl, base64Image, type, authorize, }) => { | ||
setLoading(true); | ||
@@ -271,5 +271,7 @@ return new Promise((resolve, reject) => { | ||
body: formData, | ||
headers: { | ||
Authorization: `Bearer ${token}`, | ||
}, | ||
headers: authorize | ||
? { | ||
Authorization: `Bearer ${token}`, | ||
} | ||
: {}, | ||
}).then(response => { | ||
@@ -276,0 +278,0 @@ setLoading(false); |
{ | ||
"name": "@trackunit/react-core-hooks", | ||
"version": "0.2.266", | ||
"version": "0.2.267", | ||
"repository": "https://github.com/Trackunit/manager", | ||
@@ -5,0 +5,0 @@ "license": "SEE LICENSE IN LICENSE.txt", |
@@ -15,8 +15,9 @@ export interface UploadedFile { | ||
export declare const useImageUploader: () => { | ||
uploadImage: ({ postUrl, base64Image, type }: { | ||
uploadImage: ({ postUrl, base64Image, type, authorize, }: { | ||
base64Image: string; | ||
postUrl: URL; | ||
type: "jpeg" | "png"; | ||
authorize: boolean; | ||
}) => Promise<unknown>; | ||
loading: boolean; | ||
}; |
101895
2732