Skip to content

Commit 2c255e0

Browse files
committed
Created a resendInvitation method
1 parent 378bef9 commit 2c255e0

File tree

2 files changed

+23
-2
lines changed

2 files changed

+23
-2
lines changed

generator/templates/Authorisation/src/api/endpoints/authorisation/register.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,15 @@ function acceptInvitation(email, token, password, passwordConfirmation) {
1818
});
1919
}
2020

21+
function resendInvitation(organisation, email) {
22+
return post('invitation/resend', {
23+
organisation,
24+
email,
25+
});
26+
}
27+
2128
export {
2229
verify,
2330
acceptInvitation,
31+
resendInvitation,
2432
};

generator/templates/Authorisation/src/views/authorisation/InvitationAccept.vue

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,11 @@
1212
:type="alertType"
1313
>
1414
{{ alertMessage }}
15+
<v-row class="mx-0 mt-3 justify-end">
16+
<v-btn v-if="errorCode === 400 && !!alertMessage.length" outlined @click="handleResend">
17+
{{ $t('authorisation.invitationAccept.resend') }}
18+
</v-btn>
19+
</v-row>
1520
</v-alert>
1621

1722
<k-field-group language-prefix="authorisation.fields">
@@ -54,7 +59,7 @@
5459
</template>
5560

5661
<script lang="js">
57-
import { acceptInvitation } from '@/api/endpoints/authorisation/register.js';
62+
import { acceptInvitation, resendInvitation } from '@/api/endpoints/authorisation/register.js';
5863
import { getRateLimitMinutes } from '@/api/util/response.js';
5964
import KFieldGroup from '@/components/crud/fields/KFieldGroup.vue';
6065
import KTextField from '@/components/crud/fields/KTextField.vue';
@@ -68,13 +73,16 @@ export default {
6873
},
6974
data() {
7075
return {
76+
errorCode: 0,
7177
alertType: 'success',
7278
alertMessage: '',
7379
isLoading: false,
80+
isValid: false,
81+
7482
email: this.$route.query.email,
7583
password: '',
7684
passwordConfirmation: '',
77-
isValid: false,
85+
organisation: this.$route.query.organisation,
7886
};
7987
},
8088
computed: {
@@ -99,6 +107,10 @@ export default {
99107
}
100108
},
101109
methods: {
110+
async handleResend() {
111+
await resendInvitation(this.organisation, this.email);
112+
this.$router.push({name: 'login', query: {message: 'resendInvitationSuccess'}});
113+
},
102114
handleAccept() {
103115
this.isLoading = true;
104116
acceptInvitation(this.email, this.$route.params.token, this.password, this.passwordConfirmation)
@@ -111,6 +123,7 @@ export default {
111123
const { response } = error;
112124
const { status } = response;
113125
126+
this.errorCode = status;
114127
if (status === 429) {
115128
this.alertMessage = this.$t('errors.429', { minutes: getRateLimitMinutes(response) });
116129
} else if (status === 400) {

0 commit comments

Comments
 (0)