F1Manager-Calc/libs/storage/cloudStorage.js

23 lines
605 B
JavaScript
Raw Normal View History

2023-04-18 09:23:55 +02:00
import axios from "axios";
export default function createWebStorage(type) {
return {
getItem: (key) => {
return new Promise((resolve, reject) => {
axios.get(`/api/cloud/storage`).then(d => resolve(
2023-04-18 09:25:15 +02:00
d.data ? d.data[key] : null
2023-04-18 09:23:55 +02:00
))
})
},
setItem: (key, item) => {
return new Promise((resolve, reject) => {
resolve(axios.post(`/api/cloud/storage`, {[key]: item}))
})
},
removeItem: (key) => {
return new Promise((resolve, reject) => {
resolve(axios.post(`/api/cloud/storage`, {[key]: null}))
})
},
}
}