Commit e0ab216 1 parent d47f04c commit e0ab216 Copy full SHA for e0ab216
File tree 2 files changed +6
-0
lines changed
2 files changed +6
-0
lines changed Original file line number Diff line number Diff line change 10
10
* governing permissions and limitations under the License.
11
11
*/
12
12
13
+ import { assertAuthorization } from '../../utils/auth.js' ;
13
14
import { errorResponse , errorWithResponse } from '../../utils/http.js' ;
14
15
import StorageClient from './StorageClient.js' ;
15
16
@@ -30,6 +31,8 @@ export default async function remove(ctx) {
30
31
throw errorWithResponse ( 400 , 'Helix API key is required to delete or unpublish products.' ) ;
31
32
}
32
33
34
+ await assertAuthorization ( ctx ) ;
35
+
33
36
const storage = StorageClient . fromContext ( ctx ) ;
34
37
const deleteResults = await storage . deleteProducts ( [ sku ] ) ;
35
38
Original file line number Diff line number Diff line change 13
13
import { assertValidProduct , hasUppercase } from '../../utils/product.js' ;
14
14
import { errorResponse } from '../../utils/http.js' ;
15
15
import StorageClient from './StorageClient.js' ;
16
+ import { assertAuthorization } from '../../utils/auth.js' ;
16
17
17
18
/**
18
19
* Handles a PUT request to update a product.
@@ -40,6 +41,8 @@ export default async function update(ctx) {
40
41
41
42
assertValidProduct ( product ) ;
42
43
44
+ await assertAuthorization ( ctx ) ;
45
+
43
46
const storage = StorageClient . fromContext ( ctx ) ;
44
47
const saveResults = await storage . saveProducts ( [ product ] ) ;
45
48
You can’t perform that action at this time.
0 commit comments