mirror of
https://github.com/wassname/talk.git
synced 2026-08-12 12:30:39 +08:00
Rename storage to localStorage in context
This commit is contained in:
@@ -7,7 +7,7 @@ import {
|
||||
const STORAGE_PATH = 'talkPluginRememberSort';
|
||||
|
||||
export default {
|
||||
init: async ({ store, pymStorage, introspection }) => {
|
||||
init: async ({ store, pymLocalStorage, introspection }) => {
|
||||
// TODO: workaround as this plugin is included in any target and
|
||||
// embeds (e.g. admin), but should only be included inside the stream.
|
||||
|
||||
@@ -16,10 +16,10 @@ export default {
|
||||
return;
|
||||
}
|
||||
|
||||
// We use pymStorage instead to persist the data directly on the parent page,
|
||||
// We use pymLocalStorage instead to persist the data directly on the parent page,
|
||||
// in order to mitigate strict cross domain security settings.
|
||||
|
||||
let sort = JSON.parse(await pymStorage.getItem(STORAGE_PATH));
|
||||
let sort = JSON.parse(await pymLocalStorage.getItem(STORAGE_PATH));
|
||||
if (
|
||||
sort &&
|
||||
introspection.isValidEnumValue('SORT_ORDER', sort.sortOrder) &&
|
||||
@@ -35,7 +35,7 @@ export default {
|
||||
// Save sorting choice to storage if it has changed.
|
||||
if (!sort || sort.sortOrder !== sortOrder || sort.sortBy !== sortBy) {
|
||||
sort = { sortOrder, sortBy };
|
||||
pymStorage.setItem(STORAGE_PATH, JSON.stringify(sort));
|
||||
pymLocalStorage.setItem(STORAGE_PATH, JSON.stringify(sort));
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user