MCPcopy Create free account
hub / github.com/codecombat/codecombat / archiveElement

Function archiveElement

app/core/api/archived-elements.js:9–29  ·  view source on GitHub ↗
(_id, elementType)

Source from the content-addressed store, hash-verified

7 * @async
8 */
9export const archiveElement = (_id, elementType) => {
10 if (!me.isAdmin()) {
11 throw new Error('Admin access required')
12 }
13
14 if (!_id) {
15 throw new Error('You must pass an \'_id\' to be archived')
16 }
17
18 if (!elementType) {
19 throw new Error('You must pass an \'elementType\' to be archived')
20 }
21
22 return fetchJson('/db/archived-elements', {
23 method: 'POST',
24 json: {
25 _id,
26 elementType
27 }
28 })
29}
30
31/**
32 * Un-archives a game element. This is not a destructive operation.

Callers

nothing calls this directly

Calls 1

isAdminMethod · 0.80

Tested by

no test coverage detected