Work in progress
This commit is contained in:
@@ -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();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user