Browse Source

Type fixes

kb/add-usage-guide
Matthew Aaron Raymer 1 year ago
parent
commit
b514d64068
  1. 35
      src/views/ProjectViewView.vue
  2. 11
      src/views/SeedBackupView.vue
  3. 36
      src/views/StatisticsView.vue

35
src/views/ProjectViewView.vue

@ -223,17 +223,14 @@ import {
didInfo,
GiveServerRecord,
} from "@/libs/endorserServer";
import AlertMessage from "@/components/AlertMessage";
import QuickNav from "@/components/QuickNav";
import EntityIcon from "@/components/EntityIcon";
@Component({
components: { GiftedDialog, AlertMessage, QuickNav, EntityIcon },
components: { GiftedDialog, QuickNav, EntityIcon },
})
export default class ProjectViewView extends Vue {
activeDid = "";
alertMessage = "";
alertTitle = "";
allMyDids: Array<string> = [];
allContacts: Array<Contact> = [];
apiServer = "";
@ -342,7 +339,7 @@ export default class ProjectViewView extends Vue {
this.longitude = resp.data.claim?.location?.geo?.longitude || 0;
} else if (resp.status === 404) {
// actually, axios throws an error so we never get here
this.$notify(
(this as any).$notify(
{
group: "alert",
type: "danger",
@ -355,7 +352,7 @@ export default class ProjectViewView extends Vue {
} catch (error: unknown) {
const serverError = error as AxiosError;
if (serverError.response?.status === 404) {
this.$notify(
(this as any).$notify(
{
group: "alert",
type: "danger",
@ -365,7 +362,7 @@ export default class ProjectViewView extends Vue {
-1,
);
} else {
this.$notify(
(this as any).$notify(
{
group: "alert",
type: "danger",
@ -387,7 +384,7 @@ export default class ProjectViewView extends Vue {
if (resp.status === 200 && resp.data.data) {
this.givesToThis = resp.data.data;
} else {
this.$notify(
(this as any).$notify(
{
group: "alert",
type: "danger",
@ -399,7 +396,7 @@ export default class ProjectViewView extends Vue {
}
} catch (error: unknown) {
const serverError = error as AxiosError;
this.$notify(
(this as any).$notify(
{
group: "alert",
type: "danger",
@ -423,7 +420,7 @@ export default class ProjectViewView extends Vue {
if (resp.status === 200 && resp.data.data) {
this.givesByThis = resp.data.data;
} else {
this.$notify(
(this as any).$notify(
{
group: "alert",
type: "danger",
@ -435,7 +432,7 @@ export default class ProjectViewView extends Vue {
}
} catch (error: unknown) {
const serverError = error as AxiosError;
this.$notify(
(this as any).$notify(
{
group: "alert",
type: "danger",
@ -486,9 +483,9 @@ export default class ProjectViewView extends Vue {
* @param description may be an empty string
* @param hours may be 0
*/
async recordGive(giverDid, description, hours) {
async recordGive(giverDid, description: string, hours: number) {
if (!this.activeDid) {
this.$notify(
(this as any).$notify(
{
group: "alert",
type: "danger",
@ -501,7 +498,7 @@ export default class ProjectViewView extends Vue {
}
if (!description && !hours) {
this.$notify(
(this as any).$notify(
{
group: "alert",
type: "danger",
@ -528,7 +525,7 @@ export default class ProjectViewView extends Vue {
if (result.status !== 201 || result.data?.error) {
console.log("Error with give result:", result);
this.$notify(
(this as any).$notify(
{
group: "alert",
type: "danger",
@ -540,7 +537,7 @@ export default class ProjectViewView extends Vue {
-1,
);
} else {
this.$notify(
(this as any).$notify(
{
group: "alert",
type: "success",
@ -552,14 +549,14 @@ export default class ProjectViewView extends Vue {
}
} catch (e) {
console.log("Error with give caught:", e);
this.$notify(
(this as any).$notify(
{
group: "alert",
type: "danger",
title: "Error",
text:
e.userMessage ||
e.response?.data?.error?.message ||
e?.userMessage ||
e?.response?.data?.error?.message ||
"There was an error recording the give.",
},
-1,

11
src/views/SeedBackupView.vue

@ -62,16 +62,13 @@ import { Component, Vue } from "vue-facing-decorator";
import { accountsDB, db } from "@/db";
import * as R from "ramda";
import { MASTER_SETTINGS_KEY } from "@/db/tables/settings";
import AlertMessage from "@/components/AlertMessage";
import QuickNav from "@/components/QuickNav";
import QuickNav from "@/components/QuickNav.vue";
@Component({ components: { AlertMessage, QuickNav } })
@Component({ components: { QuickNav } })
export default class SeedBackupView extends Vue {
activeAccount = null;
numAccounts = 0;
showSeed = false;
alertMessage = "";
alertTitle = "";
// 'created' hook runs when the Vue instance is first created
async created() {
@ -84,9 +81,9 @@ export default class SeedBackupView extends Vue {
const accounts = await accountsDB.accounts.toArray();
this.numAccounts = accounts.length;
this.activeAccount = R.find((acc) => acc.did === activeDid, accounts);
} catch (err) {
} catch (err: unknown) {
console.error("Got an error loading an identity:", err);
this.$notify(
(this as any).$notify(
{
group: "alert",
type: "danger",

36
src/views/StatisticsView.vue

@ -34,25 +34,26 @@
</div>
<button class="float-right" @click="captureGraphics()">Screenshot</button>
<div id="scene-container" class="h-screen"></div>
<AlertMessage
:alertTitle="alertTitle"
:alertMessage="alertMessage"
></AlertMessage>
</section>
</template>
<script lang="ts">
import { SVGRenderer } from "three/addons/renderers/SVGRenderer.js";
import { Component, Vue } from "vue-facing-decorator";
import { World } from "@/components/World/World.js";
import AlertMessage from "@/components/AlertMessage";
import QuickNav from "@/components/QuickNav";
import { World } from "components/World/World.js";
import QuickNav from "@/components/QuickNav.vue";
@Component({ components: { AlertMessage, World, QuickNav } })
interface RendererSVGType {
domElement: Element;
}
interface Dictionary<T> {
[key: string]: T;
}
@Component({ components: { World, QuickNav } })
export default class StatisticsView extends Vue {
world: World;
worldProperties: WorldProperties = {};
alertTitle = "";
alertMessage = "";
worldProperties: Dictionary<number> = {};
mounted() {
try {
@ -60,14 +61,14 @@ export default class StatisticsView extends Vue {
const newWorld = new World(container, this);
newWorld.start();
this.world = newWorld;
} catch (err) {
console.log(err);
this.$notify(
} catch (err : unknown) {
const error = err as Error;
(this as any).$notify(
{
group: "alert",
type: "danger",
title: "Mounting Error",
text: err.message,
text: error.message,
},
-1,
);
@ -85,12 +86,13 @@ export default class StatisticsView extends Vue {
ExportToSVG(rendererSVG, "test.svg");
}
public setWorldProperty(propertyName, propertyValue) {
public setWorldProperty(propertyName: string, propertyValue: number) {
this.worldProperties[propertyName] = propertyValue;
}
}
function ExportToSVG(rendererSVG, filename) {
function ExportToSVG(rendererSVG: RendererSVGType, filename: string) {
const XMLS = new XMLSerializer();
const svgfile = XMLS.serializeToString(rendererSVG.domElement);
const svgData = svgfile;

Loading…
Cancel
Save