File tree 1 file changed +10
-2
lines changed
1 file changed +10
-2
lines changed Original file line number Diff line number Diff line change @@ -74,7 +74,10 @@ export type ReactNetlifyIdentityAPI = {
74
74
_goTrueInstance : GoTrue ;
75
75
_url : string ;
76
76
loginProvider : ( provider : Provider ) => void ;
77
- acceptInviteExternalUrl : ( provider : Provider ) => string ;
77
+ acceptInviteExternalUrl : (
78
+ provider : Provider ,
79
+ autoRedirect : boolean
80
+ ) => void | string ;
78
81
settings : Settings ;
79
82
param : TokenParam ;
80
83
} ;
@@ -179,7 +182,7 @@ export function useNetlifyIdentity(
179
182
* @see https://github.com/netlify/gotrue-js/blob/master/src/index.js#L92
180
183
*/
181
184
const acceptInviteExternalUrl = useCallback (
182
- ( provider : Provider ) => {
185
+ ( provider : Provider , autoRedirect : boolean = true ) => {
183
186
if ( ! param . token || param . type !== 'invite' ) {
184
187
throw new Error ( errors . tokenMissingOrInvalid ) ;
185
188
}
@@ -188,6 +191,11 @@ export function useNetlifyIdentity(
188
191
// clean up consumed token
189
192
setParam ( defaultParam ) ;
190
193
194
+ if ( autoRedirect ) {
195
+ window . location . href = url ;
196
+ return ;
197
+ }
198
+
191
199
return url ;
192
200
} ,
193
201
[ goTrueInstance , param ]
You can’t perform that action at this time.
0 commit comments