mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-21 07:10:33 +00:00
feat(webapp): sign-up restrictions
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
// @ts-nocheck
|
||||
import React, { createContext } from 'react';
|
||||
import { useAuthMetadata } from '@/hooks/query';
|
||||
import { Spinner } from '@blueprintjs/core';
|
||||
import styled from 'styled-components';
|
||||
|
||||
const AuthMetaBootContext = createContext();
|
||||
|
||||
/**
|
||||
* Boots the authentication page metadata.
|
||||
*/
|
||||
function AuthMetaBootProvider({ ...props }) {
|
||||
const { isLoading: isAuthMetaLoading, data: authMeta } = useAuthMetadata();
|
||||
|
||||
const state = {
|
||||
isAuthMetaLoading,
|
||||
signupDisabled: authMeta?.meta?.signup_disabled,
|
||||
};
|
||||
|
||||
if (isAuthMetaLoading) {
|
||||
return (
|
||||
<SpinnerRoot>
|
||||
<Spinner size={30} value={null} />
|
||||
</SpinnerRoot>
|
||||
);
|
||||
}
|
||||
return <AuthMetaBootContext.Provider value={state} {...props} />;
|
||||
}
|
||||
|
||||
const useAuthMetaBoot = () => React.useContext(AuthMetaBootContext);
|
||||
|
||||
export { AuthMetaBootContext, AuthMetaBootProvider, useAuthMetaBoot };
|
||||
|
||||
const SpinnerRoot = styled.div`
|
||||
margin-top: 5rem;
|
||||
`;
|
||||
Reference in New Issue
Block a user