Skip to content

Commit 0402430

Browse files
authored
Merge pull request #157 from supabase/fix/signedurl-types
fix: types for create signed URL; copy it as a prop outside
2 parents beb7acb + 2beeea5 commit 0402430

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

src/lib/storage/StorageFileApi.ts

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -137,18 +137,23 @@ export class StorageFileApi {
137137
async createSignedUrl(
138138
path: string,
139139
expiresIn: number
140-
): Promise<{ data: { signedUrl: string } | null; error: Error | null }> {
140+
): Promise<{
141+
data: { signedURL: string } | null
142+
error: Error | null
143+
signedURL: string | null
144+
}> {
141145
try {
142146
const _path = this._getFinalPath(path)
143147
let data = await post(
144148
`${this.url}/object/sign/${_path}`,
145149
{ expiresIn },
146150
{ headers: this.headers }
147151
)
148-
data = { signedURL: `${this.url}${data.signedURL}` }
149-
return { data, error: null }
152+
const signedURL = `${this.url}${data.signedURL}`
153+
data = { signedURL }
154+
return { data, error: null, signedURL }
150155
} catch (error) {
151-
return { data: null, error }
156+
return { data: null, error, signedURL: null }
152157
}
153158
}
154159

0 commit comments

Comments
 (0)