Commit 6b4358ea authored by Clement Ho's avatar Clement Ho

Add search based on state

parent 7564c571
......@@ -147,7 +147,22 @@
search() {
console.log('search');
let path = '?scope=all&state=opened&utf8=✓';
let path = '?scope=all&utf8=✓';
// Check current state
const currentPath = window.location.search;
const stateIndex = currentPath.indexOf('state=');
const defaultState = 'opened';
let currentState = defaultState;
if (stateIndex !== -1) {
const remaining = currentPath.slice(stateIndex + 6);
const separatorIndex = remaining.indexOf('&');
currentState = separatorIndex === -1 ? remaining : remaining.slice(0, separatorIndex);
}
path += `&state=${currentState}`
this.tokens.forEach((token) => {
const param = validTokenKeys.find((t) => {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment