F1Manager-Calc/libs/storage/cloudStorage.js
2023-04-18 15:23:55 +08:00

23 lines
589 B
JavaScript

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(
d.data[key]
))
})
},
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}))
})
},
}
}