forked from trent_larson/crowd-funder-for-time-pwa
add way to quickly import test data when on a test instance
This commit is contained in:
@@ -53,6 +53,13 @@
|
||||
<input type="checkbox" class="mr-2" v-model="shouldErase" />
|
||||
<label>Erase the previous identifier.</label>
|
||||
</div>
|
||||
|
||||
<div v-if="isNotProdServer()" class="mt-4 text-blue-500">
|
||||
<!-- if they click this, fill in the mnemonic seed-input with the test mnemonic -->
|
||||
<button @click="mnemonic = TEST_USER_0_MNEMONIC">
|
||||
Use mnemonic for Test User #0
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="mt-8">
|
||||
@@ -79,8 +86,8 @@
|
||||
import { Component, Vue } from "vue-facing-decorator";
|
||||
import { Router } from "vue-router";
|
||||
|
||||
import { NotificationIface } from "@/constants/app";
|
||||
import { accountsDB, db } from "@/db/index";
|
||||
import { AppString, NotificationIface } from "@/constants/app";
|
||||
import { accountsDB, db, retrieveSettingsForActiveAccount } from "@/db/index";
|
||||
import { MASTER_SETTINGS_KEY } from "@/db/tables/settings";
|
||||
import {
|
||||
DEFAULT_ROOT_DERIVATION_PATH,
|
||||
@@ -92,28 +99,40 @@ import {
|
||||
components: {},
|
||||
})
|
||||
export default class ImportAccountView extends Vue {
|
||||
TEST_USER_0_MNEMONIC =
|
||||
"rigid shrug mobile smart veteran half all pond toilet brave review universe ship congress found yard skate elite apology jar uniform subway slender luggage";
|
||||
UPORT_DERIVATION_PATH = "m/7696500'/0'/0'/0'"; // for legacy imports, likely never used
|
||||
|
||||
AppString = AppString;
|
||||
|
||||
$notify!: (notification: NotificationIface, timeout?: number) => void;
|
||||
|
||||
mnemonic = "";
|
||||
apiServer = "";
|
||||
address = "";
|
||||
derivationPath = DEFAULT_ROOT_DERIVATION_PATH;
|
||||
mnemonic = "";
|
||||
numAccounts = 0;
|
||||
privateHex = "";
|
||||
publicHex = "";
|
||||
derivationPath = DEFAULT_ROOT_DERIVATION_PATH;
|
||||
showAdvanced = false;
|
||||
shouldErase = false;
|
||||
|
||||
async created() {
|
||||
await accountsDB.open();
|
||||
this.numAccounts = await accountsDB.accounts.count();
|
||||
// get the server, to help with import on the test server
|
||||
const settings = await retrieveSettingsForActiveAccount();
|
||||
this.apiServer = settings.apiServer || "";
|
||||
}
|
||||
|
||||
public onCancelClick() {
|
||||
(this.$router as Router).back();
|
||||
}
|
||||
|
||||
public isNotProdServer() {
|
||||
return this.apiServer !== AppString.PROD_ENDORSER_API_SERVER;
|
||||
}
|
||||
|
||||
public async fromMnemonic() {
|
||||
const mne: string = this.mnemonic.trim().toLowerCase();
|
||||
try {
|
||||
|
||||
Reference in New Issue
Block a user