| 7 | * @async |
| 8 | */ |
| 9 | export 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. |