@react-pakistan/util-functions 1.23.73 → 1.23.74
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -3,6 +3,5 @@ export interface fetchSupabasePrivateImageArgs {
|
|
|
3
3
|
callback: (url: string | Blob) => void;
|
|
4
4
|
fetchUrl: string;
|
|
5
5
|
token: string;
|
|
6
|
-
mode?: 'web' | 'mobile';
|
|
7
6
|
}
|
|
8
|
-
export declare const fetchSupabasePrivateImage: ({ apikey, callback, fetchUrl, token,
|
|
7
|
+
export declare const fetchSupabasePrivateImage: ({ apikey, callback, fetchUrl, token, }: fetchSupabasePrivateImageArgs) => Promise<void>;
|
|
@@ -41,9 +41,9 @@ exports.fetchSupabasePrivateImage = void 0;
|
|
|
41
41
|
var constants_1 = require("../constants");
|
|
42
42
|
var fetchSupabasePrivateImage = function (_a) { return __awaiter(void 0, [_a], void 0, function (_b) {
|
|
43
43
|
var response, blob, url;
|
|
44
|
-
var apikey = _b.apikey, callback = _b.callback, fetchUrl = _b.fetchUrl, token = _b.token
|
|
45
|
-
return __generator(this, function (
|
|
46
|
-
switch (
|
|
44
|
+
var apikey = _b.apikey, callback = _b.callback, fetchUrl = _b.fetchUrl, token = _b.token;
|
|
45
|
+
return __generator(this, function (_c) {
|
|
46
|
+
switch (_c.label) {
|
|
47
47
|
case 0: return [4 /*yield*/, fetch(fetchUrl, {
|
|
48
48
|
method: constants_1.API_METHODS.GET,
|
|
49
49
|
headers: {
|
|
@@ -53,18 +53,14 @@ var fetchSupabasePrivateImage = function (_a) { return __awaiter(void 0, [_a], v
|
|
|
53
53
|
},
|
|
54
54
|
})];
|
|
55
55
|
case 1:
|
|
56
|
-
response =
|
|
56
|
+
response = _c.sent();
|
|
57
57
|
if (!response.ok) return [3 /*break*/, 3];
|
|
58
58
|
return [4 /*yield*/, response.blob()];
|
|
59
59
|
case 2:
|
|
60
|
-
blob =
|
|
61
|
-
if (mode === 'mobile') {
|
|
62
|
-
callback(blob);
|
|
63
|
-
return [2 /*return*/];
|
|
64
|
-
}
|
|
60
|
+
blob = _c.sent();
|
|
65
61
|
url = URL.createObjectURL(blob);
|
|
66
62
|
callback(url);
|
|
67
|
-
|
|
63
|
+
_c.label = 3;
|
|
68
64
|
case 3: return [2 /*return*/];
|
|
69
65
|
}
|
|
70
66
|
});
|