useCreateProject
Datalayer Core / useCreateProject
Function: useCreateProject()
useCreateProject(): {
context:unknown;createProject: (request) =>Promise<any>;data:undefined;error:null;failureCount:number;failureReason:Error|null;isError:false;isIdle:true;isPaused:boolean;isPending:false;isSuccess:false;mutate:UseMutateFunction<any,Error, {organization?:IAnyOrganization;space:Partial<IAnySpace>; },unknown>;mutateAsync:UseMutateAsyncFunction<any,Error, {organization?:IAnyOrganization;space:Partial<IAnySpace>; },unknown>;reset: () =>void;status:"idle";submittedAt:number;variables:undefined; } | {context:unknown;createProject: (request) =>Promise<any>;data:undefined;error:null;failureCount:number;failureReason:Error|null;isError:false;isIdle:false;isPaused:boolean;isPending:true;isSuccess:false;mutate:UseMutateFunction<any,Error, {organization?:IAnyOrganization;space:Partial<IAnySpace>; },unknown>;mutateAsync:UseMutateAsyncFunction<any,Error, {organization?:IAnyOrganization;space:Partial<IAnySpace>; },unknown>;reset: () =>void;status:"pending";submittedAt:number;variables: {organization?:IAnyOrganization;space:Partial<IAnySpace>; }; } | {context:unknown;createProject: (request) =>Promise<any>;data:undefined;error:Error;failureCount:number;failureReason:Error|null;isError:true;isIdle:false;isPaused:boolean;isPending:false;isSuccess:false;mutate:UseMutateFunction<any,Error, {organization?:IAnyOrganization;space:Partial<IAnySpace>; },unknown>;mutateAsync:UseMutateAsyncFunction<any,Error, {organization?:IAnyOrganization;space:Partial<IAnySpace>; },unknown>;reset: () =>void;status:"error";submittedAt:number;variables: {organization?:IAnyOrganization;space:Partial<IAnySpace>; }; } | {context:unknown;createProject: (request) =>Promise<any>;data:any;error:null;failureCount:number;failureReason:Error|null;isError:false;isIdle:false;isPaused:boolean;isPending:false;isSuccess:true;mutate:UseMutateFunction<any,Error, {organization?:IAnyOrganization;space:Partial<IAnySpace>; },unknown>;mutateAsync:UseMutateAsyncFunction<any,Error, {organization?:IAnyOrganization;space:Partial<IAnySpace>; },unknown>;reset: () =>void;status:"success";submittedAt:number;variables: {organization?:IAnyOrganization;space:Partial<IAnySpace>; }; }
Defined in: src/hooks/useProjects.ts:125
Hook to create a new project. Creates a space with type "project" via the spacer service.
Returns
Type Literal
{ context: unknown; createProject: (request) => Promise<any>; data: undefined; error: null; failureCount: number; failureReason: Error | null; isError: false; isIdle: true; isPaused: boolean; isPending: false; isSuccess: false; mutate: UseMutateFunction<any, Error, { organization?: IAnyOrganization; space: Partial<IAnySpace>; }, unknown>; mutateAsync: UseMutateAsyncFunction<any, Error, { organization?: IAnyOrganization; space: Partial<IAnySpace>; }, unknown>; reset: () => void; status: "idle"; submittedAt: number; variables: undefined; }
context
context:
unknown
createProject
createProject: (
request) =>Promise<any>
Parameters
request
Returns
Promise<any>
data
data:
undefined
The last successfully resolved data for the mutation.
error
error:
null
The error object for the mutation, if an error was encountered.
- Defaults to
null.
failureCount
failureCount:
number
failureReason
failureReason:
Error|null
isError
isError:
false
A boolean variable derived from status.
trueif the last mutation attempt resulted in an error.
isIdle
isIdle:
true
A boolean variable derived from status.
trueif the mutation is in its initial state prior to executing.
isPaused
isPaused:
boolean
isPending
isPending:
false
A boolean variable derived from status.
trueif the mutation is currently executing.
isSuccess
isSuccess:
false
A boolean variable derived from status.
trueif the last mutation attempt was successful.
mutate
mutate:
UseMutateFunction<any,Error, {organization?:IAnyOrganization;space:Partial<IAnySpace>; },unknown>
The mutation function you can call with variables to trigger the mutation and optionally hooks on additional callback options.
Param
The variables object to pass to the mutationFn.
Param
This function will fire when the mutation is successful and will be passed the mutation's result.
Param
This function will fire if the mutation encounters an error and will be passed the error.
Param
This function will fire when the mutation is either successfully fetched or encounters an error and be passed either the data or error.
Remarks
- If you make multiple requests,
onSuccesswill fire only after the latest call you've made. - All the callback functions (
onSuccess,onError,onSettled) are void functions, and the returned value will be ignored.
mutateAsync
mutateAsync:
UseMutateAsyncFunction<any,Error, {organization?:IAnyOrganization;space:Partial<IAnySpace>; },unknown>
reset
reset: () =>
void
A function to clean the mutation internal state (i.e., it resets the mutation to its initial state).
Returns
void
status
status:
"idle"
The status of the mutation.
- Will be:
idleinitial status prior to the mutation function executing.pendingif the mutation is currently executing.errorif the last mutation attempt resulted in an error.successif the last mutation attempt was successful.
submittedAt
submittedAt:
number
variables
variables:
undefined
The variables object passed to the mutationFn.
Type Literal
{ context: unknown; createProject: (request) => Promise<any>; data: undefined; error: null; failureCount: number; failureReason: Error | null; isError: false; isIdle: false; isPaused: boolean; isPending: true; isSuccess: false; mutate: UseMutateFunction<any, Error, { organization?: IAnyOrganization; space: Partial<IAnySpace>; }, unknown>; mutateAsync: UseMutateAsyncFunction<any, Error, { organization?: IAnyOrganization; space: Partial<IAnySpace>; }, unknown>; reset: () => void; status: "pending"; submittedAt: number; variables: { organization?: IAnyOrganization; space: Partial<IAnySpace>; }; }
context
context:
unknown
createProject
createProject: (
request) =>Promise<any>
Parameters
request
Returns
Promise<any>
data
data:
undefined
The last successfully resolved data for the mutation.
error
error:
null
The error object for the mutation, if an error was encountered.
- Defaults to
null.
failureCount
failureCount:
number
failureReason
failureReason:
Error|null
isError
isError:
false
A boolean variable derived from status.
trueif the last mutation attempt resulted in an error.
isIdle
isIdle:
false
A boolean variable derived from status.
trueif the mutation is in its initial state prior to executing.
isPaused
isPaused:
boolean
isPending
isPending:
true
A boolean variable derived from status.
trueif the mutation is currently executing.
isSuccess
isSuccess:
false
A boolean variable derived from status.
trueif the last mutation attempt was successful.
mutate
mutate:
UseMutateFunction<any,Error, {organization?:IAnyOrganization;space:Partial<IAnySpace>; },unknown>
The mutation function you can call with variables to trigger the mutation and optionally hooks on additional callback options.
Param
The variables object to pass to the mutationFn.
Param
This function will fire when the mutation is successful and will be passed the mutation's result.
Param
This function will fire if the mutation encounters an error and will be passed the error.
Param
This function will fire when the mutation is either successfully fetched or encounters an error and be passed either the data or error.
Remarks
- If you make multiple requests,
onSuccesswill fire only after the latest call you've made. - All the callback functions (
onSuccess,onError,onSettled) are void functions, and the returned value will be ignored.
mutateAsync
mutateAsync:
UseMutateAsyncFunction<any,Error, {organization?:IAnyOrganization;space:Partial<IAnySpace>; },unknown>
reset
reset: () =>
void
A function to clean the mutation internal state (i.e., it resets the mutation to its initial state).
Returns
void
status
status:
"pending"
The status of the mutation.
- Will be:
idleinitial status prior to the mutation function executing.pendingif the mutation is currently executing.errorif the last mutation attempt resulted in an error.successif the last mutation attempt was successful.
submittedAt
submittedAt:
number
variables
variables:
object
The variables object passed to the mutationFn.
variables.organization?
optionalorganization?:IAnyOrganization
variables.space
space:
Partial<IAnySpace>
Type Literal
{ context: unknown; createProject: (request) => Promise<any>; data: undefined; error: Error; failureCount: number; failureReason: Error | null; isError: true; isIdle: false; isPaused: boolean; isPending: false; isSuccess: false; mutate: UseMutateFunction<any, Error, { organization?: IAnyOrganization; space: Partial<IAnySpace>; }, unknown>; mutateAsync: UseMutateAsyncFunction<any, Error, { organization?: IAnyOrganization; space: Partial<IAnySpace>; }, unknown>; reset: () => void; status: "error"; submittedAt: number; variables: { organization?: IAnyOrganization; space: Partial<IAnySpace>; }; }
context
context:
unknown
createProject
createProject: (
request) =>Promise<any>
Parameters
request
Returns
Promise<any>
data
data:
undefined
The last successfully resolved data for the mutation.
error
error:
Error
The error object for the mutation, if an error was encountered.
- Defaults to
null.
failureCount
failureCount:
number
failureReason
failureReason:
Error|null
isError
isError:
true
A boolean variable derived from status.
trueif the last mutation attempt resulted in an error.
isIdle
isIdle:
false
A boolean variable derived from status.
trueif the mutation is in its initial state prior to executing.
isPaused
isPaused:
boolean
isPending
isPending:
false
A boolean variable derived from status.
trueif the mutation is currently executing.
isSuccess
isSuccess:
false
A boolean variable derived from status.
trueif the last mutation attempt was successful.
mutate
mutate:
UseMutateFunction<any,Error, {organization?:IAnyOrganization;space:Partial<IAnySpace>; },unknown>
The mutation function you can call with variables to trigger the mutation and optionally hooks on additional callback options.
Param
The variables object to pass to the mutationFn.
Param
This function will fire when the mutation is successful and will be passed the mutation's result.
Param
This function will fire if the mutation encounters an error and will be passed the error.
Param
This function will fire when the mutation is either successfully fetched or encounters an error and be passed either the data or error.
Remarks
- If you make multiple requests,
onSuccesswill fire only after the latest call you've made. - All the callback functions (
onSuccess,onError,onSettled) are void functions, and the returned value will be ignored.
mutateAsync
mutateAsync:
UseMutateAsyncFunction<any,Error, {organization?:IAnyOrganization;space:Partial<IAnySpace>; },unknown>
reset
reset: () =>
void
A function to clean the mutation internal state (i.e., it resets the mutation to its initial state).
Returns
void
status
status:
"error"
The status of the mutation.
- Will be:
idleinitial status prior to the mutation function executing.pendingif the mutation is currently executing.errorif the last mutation attempt resulted in an error.successif the last mutation attempt was successful.
submittedAt
submittedAt:
number
variables
variables:
object
The variables object passed to the mutationFn.
variables.organization?
optionalorganization?:IAnyOrganization
variables.space
space:
Partial<IAnySpace>
Type Literal
{ context: unknown; createProject: (request) => Promise<any>; data: any; error: null; failureCount: number; failureReason: Error | null; isError: false; isIdle: false; isPaused: boolean; isPending: false; isSuccess: true; mutate: UseMutateFunction<any, Error, { organization?: IAnyOrganization; space: Partial<IAnySpace>; }, unknown>; mutateAsync: UseMutateAsyncFunction<any, Error, { organization?: IAnyOrganization; space: Partial<IAnySpace>; }, unknown>; reset: () => void; status: "success"; submittedAt: number; variables: { organization?: IAnyOrganization; space: Partial<IAnySpace>; }; }
context
context:
unknown
createProject
createProject: (
request) =>Promise<any>
Parameters
request
Returns
Promise<any>
data
data:
any
The last successfully resolved data for the mutation.
error
error:
null
The error object for the mutation, if an error was encountered.
- Defaults to
null.
failureCount
failureCount:
number
failureReason
failureReason:
Error|null
isError
isError:
false
A boolean variable derived from status.
trueif the last mutation attempt resulted in an error.
isIdle
isIdle:
false
A boolean variable derived from status.
trueif the mutation is in its initial state prior to executing.
isPaused
isPaused:
boolean
isPending
isPending:
false
A boolean variable derived from status.
trueif the mutation is currently executing.
isSuccess
isSuccess:
true
A boolean variable derived from status.
trueif the last mutation attempt was successful.
mutate
mutate:
UseMutateFunction<any,Error, {organization?:IAnyOrganization;space:Partial<IAnySpace>; },unknown>
The mutation function you can call with variables to trigger the mutation and optionally hooks on additional callback options.
Param
The variables object to pass to the mutationFn.
Param
This function will fire when the mutation is successful and will be passed the mutation's result.
Param
This function will fire if the mutation encounters an error and will be passed the error.
Param
This function will fire when the mutation is either successfully fetched or encounters an error and be passed either the data or error.
Remarks
- If you make multiple requests,
onSuccesswill fire only after the latest call you've made. - All the callback functions (
onSuccess,onError,onSettled) are void functions, and the returned value will be ignored.
mutateAsync
mutateAsync:
UseMutateAsyncFunction<any,Error, {organization?:IAnyOrganization;space:Partial<IAnySpace>; },unknown>
reset
reset: () =>
void
A function to clean the mutation internal state (i.e., it resets the mutation to its initial state).
Returns
void
status
status:
"success"
The status of the mutation.
- Will be:
idleinitial status prior to the mutation function executing.pendingif the mutation is currently executing.errorif the last mutation attempt resulted in an error.successif the last mutation attempt was successful.
submittedAt
submittedAt:
number
variables
variables:
object
The variables object passed to the mutationFn.
variables.organization?
optionalorganization?:IAnyOrganization
variables.space
space:
Partial<IAnySpace>