Work in progress

This commit is contained in:
Matthew Aaron Raymer
2023-01-03 17:28:23 +08:00
parent 0ee35e4946
commit 6325bcbe35
7 changed files with 102 additions and 25 deletions

View File

@@ -213,7 +213,6 @@ export default class AccountViewView extends Vue {
await db.open();
const num_accounts = await db.accounts.count();
if (num_accounts === 0) {
console.log("...");
await db.accounts.add({
publicKey: newId.keys[0].publicKeyHex,
mnemonic: this.mnemonic,
@@ -223,7 +222,6 @@ export default class AccountViewView extends Vue {
}
useAppStore().setCondition("registered");
} catch (err) {
console.log("Error!");
console.log(err);
}
}

View File

@@ -72,6 +72,9 @@
<script lang="ts">
import { Options, Vue } from "vue-class-component";
import { AppString } from "@/constants/app";
import { db } from "../db";
import { accessToken } from "@/libs/crypto";
@Options({
components: {},
@@ -79,9 +82,44 @@ import { Options, Vue } from "vue-class-component";
export default class NewEditProjectView extends Vue {
projectName = "";
description = "";
public async onSaveProjectClick() {
console.log("Placeholder");
await db.open();
const num_accounts = await db.accounts.count();
if (num_accounts === 0) {
console.log("Problem! Should have a profile!");
} else {
const accounts = await db.accounts.toArray();
const identity = JSON.parse(accounts[0].identity);
const address = identity.did;
const vcClaim = {
"@context": "https://schema.org",
"@type": "Plan",
identifier: address,
name: this.projectName,
description: this.description,
};
const jwt = "";
const payload = JSON.stringify({ jwtEncoded: jwt});
const endorserApiServer = AppString.DEFAULT_ENDORSER_API_SERVER;
const url = endorserApiServer + "/api/claim";
const token = await accessToken(identity)
const headers = {
'Content-Type': 'application/json',
'Uport-Push-Token': token
}
try {
let resp = await this.axios.post(url, payload, { headers });
} catch (error) {
console.log(error);
}
}
}
public onCancelClick() {
this.$router.back();
}