mirror of
https://github.com/digitalocean/nginxconfig.io
synced 2024-11-10 04:24:12 +00:00
Add writing of query params
This commit is contained in:
parent
795edd2255
commit
f2c0878cda
4 changed files with 27 additions and 6 deletions
11
package-lock.json
generated
11
package-lock.json
generated
|
@ -6334,9 +6334,9 @@
|
|||
"integrity": "sha1-fjL3W0E4EpHQRhHxvxQQmsAGUdc="
|
||||
},
|
||||
"qs": {
|
||||
"version": "6.5.2",
|
||||
"resolved": "https://registry.npmjs.org/qs/-/qs-6.5.2.tgz",
|
||||
"integrity": "sha512-N5ZAX4/LxJmF+7wN74pUD6qAh9/wnvdQcjq9TZjevvXzSUo7bfmw91saqMjzGS2xq91/odN2dW/WOl7qQHNDGA=="
|
||||
"version": "6.9.4",
|
||||
"resolved": "https://registry.npmjs.org/qs/-/qs-6.9.4.tgz",
|
||||
"integrity": "sha512-A1kFqHekCTM7cz0udomYUoYNWjBebHm/5wzU/XqrBRBNWectVH0QIiN+NEcZ0Dte5hvzHwbr8+XQmguPhJ6WdQ=="
|
||||
},
|
||||
"querystring": {
|
||||
"version": "0.2.0",
|
||||
|
@ -6556,6 +6556,11 @@
|
|||
"uuid": "^3.3.2"
|
||||
},
|
||||
"dependencies": {
|
||||
"qs": {
|
||||
"version": "6.5.2",
|
||||
"resolved": "https://registry.npmjs.org/qs/-/qs-6.5.2.tgz",
|
||||
"integrity": "sha512-N5ZAX4/LxJmF+7wN74pUD6qAh9/wnvdQcjq9TZjevvXzSUo7bfmw91saqMjzGS2xq91/odN2dW/WOl7qQHNDGA=="
|
||||
},
|
||||
"tough-cookie": {
|
||||
"version": "2.5.0",
|
||||
"resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-2.5.0.tgz",
|
||||
|
|
|
@ -38,6 +38,7 @@
|
|||
"do-vue": "git+https://github.com/do-community/do-vue.git",
|
||||
"parcel-bundler": "^1.12.4",
|
||||
"pretty-checkbox-vue": "^1.1.9",
|
||||
"qs": "^6.9.4",
|
||||
"vue": "^2.6.11",
|
||||
"vue-hot-reload-api": "^2.3.3",
|
||||
"vue-select": "^3.10.3",
|
||||
|
|
|
@ -46,7 +46,7 @@
|
|||
<input v-model="shareLink"
|
||||
class="input"
|
||||
type="text"
|
||||
disabled="disabled"
|
||||
readonly="readonly"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -108,6 +108,7 @@
|
|||
|
||||
<script>
|
||||
import PrettyCheck from 'pretty-checkbox-vue/check';
|
||||
import qs from 'qs';
|
||||
import i18n from '../../i18n';
|
||||
import delegatedFromDefaults from '../../util/delegated_from_defaults';
|
||||
import computedFromDefaults from '../../util/computed_from_defaults';
|
||||
|
@ -145,8 +146,19 @@
|
|||
hasDomain() {
|
||||
return this.$parent.$parent.activeDomains.length > 0;
|
||||
},
|
||||
shareQuery() {
|
||||
const data = exportData(this.$parent.$parent.activeDomains, this.$parent.$props.data);
|
||||
return qs.stringify(data, { allowDots: true });
|
||||
},
|
||||
shareLink() {
|
||||
return JSON.stringify(exportData(this.$parent.$parent.activeDomains, this.$parent.$props.data));
|
||||
const base = `${window.location.protocol}//${window.location.host}${window.location.pathname}`;
|
||||
return `${base}${this.shareQuery.length ? '?' : ''}${this.shareQuery}`;
|
||||
},
|
||||
},
|
||||
watch: {
|
||||
// When the share link changes, update the site query
|
||||
shareQuery(query) {
|
||||
window.history.replaceState({}, '', `?${query}`);
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
|
|
|
@ -29,7 +29,10 @@ export default (domains, global) => {
|
|||
|
||||
// Handle domains
|
||||
// Always save changes, even if none, so we can replicate the correct number of domains
|
||||
exportData.domains = domains.map(domain => categoriesExport(domain[0]));
|
||||
exportData.domains = domains.map(domain => categoriesExport(domain[0])).reduce((prev, current, index) => {
|
||||
prev[index] = current;
|
||||
return prev;
|
||||
}, {});
|
||||
|
||||
// Handle global
|
||||
// If there were any category changes, save global changes
|
||||
|
|
Loading…
Reference in a new issue