简体   繁体   中英

What is best practice to save tempory data as a sub option on backend panel?

Hi I started programming a while back and are still trying to improve my practice. My current question is this:

I have a backend application where admin can add courses to the website.

One of the section is admin can define multiple time schedule to the course.

My current approach is when admin pressed the create button, I will have a uid as a tempory index. When schedules are added, the current record is saved to a tempory database table along with the uid. When all things are filled and saved, I will run a query toeless the tempory table with the uid and update it linking to the id of the newly created program.

I sense this is not the best approach as it requires calling to database for every action inside the schedule option (CRUD). I did look up and found some articles on local storage or sessions which I don't think is suitable for my scenario. I am getting my hands dirty with Vue recently and thought about storing the tempory schedule inside a data variable.

Could anyone please advice some good practice for this scenario? Advices for both Vue and normal Javascript is greatly appreciated

you can try IndexedDB API along with Dexie.js, here is the documentation of IndexedDB IndexedDB , Dexie documentation Dexie , but as the comments say Keeping the db as the current source of truth is safest thing to do =)

Hope it helps =)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM