-
-
Notifications
You must be signed in to change notification settings - Fork 17
/
loader.js
69 lines (54 loc) · 1.91 KB
/
loader.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
// This is used in DEV environments where we don't actually connect to the KV stores...
// ...so we stub the implementations and download everything locally instead
const _get = async (url) => {
const response = await fetch(url, {})
return response.json()
};
if (typeof DATA_CACHE === 'undefined') {
global.DATA_CACHE = {
get: async (what) => {
console.log(`trying to get ${what}`)
if (what === 'TRADER_ITEMS') {
console.log('getting trader items');
return _get(
'https://manager.tarkov.dev/data/trader-items.json'
);
}
if (what === 'ITEM_CACHE') {
console.log('getting item cache');
return _get(
'https://manager.tarkov.dev/data/item-data.json'
);
}
if (what === 'BARTER_DATA') {
console.log('getting barter data');
return _get(
'https://manager.tarkov.dev/data/barter-data.json'
);
}
if (what === 'CRAFT_DATA') {
console.log('getting craft data');
return _get(
'https://manager.tarkov.dev/data/craft-data.json'
);
}
if (what === 'HIDEOUT_DATA') {
console.log('getting hideout data');
return _get(
'https://manager.tarkov.dev/data/hideout-data.json'
);
}
if (what === 'QUEST_DATA') {
console.log('getting quest data');
return _get(
'https://manager.tarkov.dev/data/quest-data.json'
);
}
return null
},
put: async (...a) => {
console.log('trying to PUT item data', ...a)
return false
},
}
}