refactor invite link & add test

This commit is contained in:
2024-10-08 08:36:32 -06:00
parent 2e100aedf5
commit 98afa8a259
8 changed files with 81 additions and 37 deletions

View File

@@ -1,12 +1,14 @@
<template>
<div v-if="visible" class="dialog-overlay">
<div class="dialog">
<h1 class="text-xl font-bold text-center mb-4">{{ title }}</h1>
<h1 class="text-xl font-bold text-center mb-4">Invitation & Notes</h1>
{{ message }}
These are optional notes for your use, to make comments for to recall
later when redeemed by someone. These notes are sent to the server. If you
want to store your own way, the invitation ID is: {{ inviteIdentifier }}
<input
type="text"
placeholder="Name"
placeholder="Notes"
class="block w-full rounded border border-slate-400 mb-4 px-3 py-2"
v-model="text"
/>
@@ -52,22 +54,19 @@ export default class InviteDialog extends Vue {
$notify!: (notification: NotificationIface, timeout?: number) => void;
callback: (text: string, expiresAt: string) => void = () => {};
message = "";
inviteIdentifier = "";
text = "";
title = "";
visible = false;
expiresAt = new Date(Date.now() + 1000 * 60 * 60 * 24 * 30 * 3)
.toISOString()
.substring(0, 10);
async open(
title: string,
message: string,
inviteIdentifier: string,
aCallback: (text: string, expiresAt: string) => void,
) {
this.callback = aCallback;
this.title = title;
this.message = message;
this.inviteIdentifier = inviteIdentifier;
this.visible = true;
}