Tutorial Working
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import { Account } from "@/interface/Account";
|
||||
import { AccountTutorialStatus } from "@/interface/AccountTutorialStatus";
|
||||
import { RaidGroupPermissionType } from "@/interface/RaidGroup";
|
||||
import { api } from "@/util/AxiosUtil";
|
||||
import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query";
|
||||
@@ -124,6 +125,41 @@ export function useGetAccountsByRaidGroupCount(raidGroupId: string, searchTerm?:
|
||||
});
|
||||
}
|
||||
|
||||
export function useGetTutorialsStatus(accountId: string | null){
|
||||
return useQuery({
|
||||
queryKey: ["tutorials", "account", accountId],
|
||||
queryFn: async () => {
|
||||
const response = await api.get(`/account/tutorial`);
|
||||
|
||||
if(response.status !== 200){
|
||||
throw new Error("Failed to get tutorials status");
|
||||
}
|
||||
else if(response.data.errors){
|
||||
throw new Error(response.data.errors.join(", "));
|
||||
}
|
||||
|
||||
return response.data as AccountTutorialStatus;
|
||||
},
|
||||
enabled: !!accountId
|
||||
});
|
||||
}
|
||||
|
||||
export function useUpdateTutorialsStatus(){
|
||||
return useMutation({
|
||||
mutationKey: ["tutorials", "accounts"],
|
||||
mutationFn: async (tutorials: AccountTutorialStatus) => {
|
||||
const response = await api.put(`/account/tutorial`, tutorials);
|
||||
|
||||
if(response.status !== 200){
|
||||
throw new Error("Failed to update tutorials status");
|
||||
}
|
||||
else if(response.data.errors){
|
||||
throw new Error(response.data.errors.join(", "));
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
export function useForcePasswordReset(accountId: string){
|
||||
|
||||
Reference in New Issue
Block a user