mirror of
https://github.com/makeplane/plane
synced 2024-06-14 14:31:34 +00:00
a1b09fcbc6
* style: new onboarding screens * chore: onboarding tour screens * fix: build error * fix: build errors * style: default layout background * chor: update user auth hook logic, style: new onboarding screens * fix: component structure * chore: tab responsiveness added * fix: redirection logic * style: welcome screens responsiveness * chore: update workspace url input field * style: mobile responsiveness added * chore: complete onboarding workflow * style: create workspace page design update * style: workspace invitations page design update * chore: update steps logic * fix: step change logic * style: tour steps
28 lines
688 B
TypeScript
28 lines
688 B
TypeScript
import { useRouter } from "next/router";
|
|
|
|
import useSWR from "swr";
|
|
|
|
// services
|
|
import workspaceService from "services/workspace.service";
|
|
// fetch-keys
|
|
import { USER_WORKSPACES } from "constants/fetch-keys";
|
|
|
|
const useWorkspaces = () => {
|
|
// router
|
|
const router = useRouter();
|
|
const { workspaceSlug } = router.query;
|
|
// API to fetch user information
|
|
const { data, error, mutate } = useSWR(USER_WORKSPACES, () => workspaceService.userWorkspaces());
|
|
// active workspace
|
|
const activeWorkspace = data?.find((w) => w.slug === workspaceSlug);
|
|
|
|
return {
|
|
workspaces: data,
|
|
error,
|
|
activeWorkspace,
|
|
mutateWorkspaces: mutate,
|
|
};
|
|
};
|
|
|
|
export default useWorkspaces;
|