2020-12-15 22:00:45 +01:00
|
|
|
// TODO: this import should be removed once refactoring is finished
|
|
|
|
import { eventStore } from '../../frontend/stores'
|
|
|
|
|
2020-12-12 13:54:59 +01:00
|
|
|
const getConfigStorage = () => {
|
|
|
|
const storage = localStorage.getItem('fb-to-ical-config')
|
|
|
|
|
|
|
|
if (!storage) {
|
|
|
|
localStorage.setItem('fb-to-ical-config', JSON.stringify({}))
|
|
|
|
return "{}"
|
|
|
|
}
|
|
|
|
|
|
|
|
return storage
|
|
|
|
}
|
|
|
|
|
2020-07-17 20:18:55 +02:00
|
|
|
const getStorageContents = (storage) => {
|
|
|
|
return JSON.parse(storage)
|
|
|
|
}
|
|
|
|
|
|
|
|
const saveRecord = ({ id, link, createdAt, startTime, title }) => {
|
2020-12-15 22:00:45 +01:00
|
|
|
eventStore.setCalculation({ id, link, createdAt, startTime, title })
|
2020-07-17 20:18:55 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
export {
|
2020-12-12 13:54:59 +01:00
|
|
|
getConfigStorage,
|
2020-07-17 20:18:55 +02:00
|
|
|
getStorageContents,
|
|
|
|
saveRecord,
|
|
|
|
}
|