change member invite to api route, add resend invitation mail, add delete invitation, fixes ST-87

This commit is contained in:
Gregor Vostrak
2024-06-26 14:32:16 +02:00
parent 42da2c3397
commit 099926f95c
12 changed files with 207 additions and 31 deletions

View File

@@ -89,6 +89,9 @@ export type Member = MemberIndexResponse['data'][0];
export type UpdateMemberBody = ZodiosBodyByAlias<SolidTimeApi, 'updateMember'>;
export type InviteMemberBody = ZodiosBodyByAlias<SolidTimeApi, 'invite'>;
export type MemberRole = InviteMemberBody['role'];
export type CreateTagBody = ZodiosBodyByAlias<SolidTimeApi, 'createTag'>;
export type ImportType = ZodiosResponseByAlias<

View File

@@ -7,3 +7,8 @@ export function isBillingActivated() {
return page.props.has_billing_extension;
}
export function hasActiveSubscription() {
// TODO: Replace with server side check
return true;
}

View File

@@ -41,13 +41,17 @@ export const useNotificationsStore = defineStore('notifications', () => {
async function handleApiRequestNotifications<T>(
apiRequest: () => Promise<T>,
successMessage?: string,
errorMessage?: string
errorMessage?: string,
onSuccess?: (response: T) => void
) {
try {
const response = await apiRequest();
if (successMessage) {
addNotification('success', successMessage);
}
if (onSuccess) {
onSuccess(response);
}
return response;
} catch (error) {
if (axios.isAxiosError(error)) {
@@ -72,6 +76,9 @@ export const useNotificationsStore = defineStore('notifications', () => {
if (successMessage) {
addNotification('success', successMessage);
}
if (onSuccess) {
onSuccess(response);
}
return response;
} catch (error) {
router.get(route('login'));