Skip to content

Instantly share code, notes, and snippets.

@odanado
Created March 22, 2018 15:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save odanado/72ee172f4ef0f59220ce05f9fa2f3756 to your computer and use it in GitHub Desktop.
Save odanado/72ee172f4ef0f59220ce05f9fa2f3756 to your computer and use it in GitHub Desktop.
<template>
<div>
<div>
<button
v-for="(_, i) in 17"
:key="i"
@click="needles.push(i)">
{{ i }}
</button>
</div>
<select v-model="selectedSearchMode">
<option
v-for="searchMode in searchModes"
:key="searchMode">
{{ searchMode }}
</option>
</select>
<p>needles: {{ needles }}</p>
<button @click="fetchSeed()">
send
</button>
<ul>
<li
v-for="result in results"
:key="result.seed">
{{ result.seed }}
</li>
</ul>
</div>
</template>
<script>
import axios from 'axios';
export default {
data() {
return {
needles: [],
searchModes: ['usm/sfmt/seed', 'sm/sfmt/seed'],
selectedSearchMode: 'usm/sfmt/seed',
results: [],
};
},
methods: {
async fetchSeed() {
const url = `https://rng-api.odanado.com/${this.selectedSearchMode}`;
const response = await axios.get(url, {
params: { needle: this.needles.join() },
});
this.results = response.data.results;
},
},
};
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment