@@ -49,7 +49,8 @@ const netlifyIdentity = {
4949 } ,
5050 init : options => {
5151 init ( options ) ;
52- }
52+ } ,
53+ store
5354} ;
5455
5556let queuedIframeStyle = null ;
@@ -71,9 +72,12 @@ const localHosts = {
7172 "0.0.0.0" : true
7273} ;
7374
74- function instantiateGotrue ( ) {
75+ function instantiateGotrue ( APIUrl ) {
7576 const isLocal = localHosts [ document . location . host . split ( ":" ) . shift ( ) ] ;
7677 const siteURL = isLocal && localStorage . getItem ( "netlifySiteURL" ) ;
78+ if ( APIUrl ) {
79+ return new GoTrue ( { APIUrl, setCookie : ! isLocal } ) ;
80+ }
7781 if ( isLocal && siteURL ) {
7882 const parts = [ siteURL ] ;
7983 if ( ! siteURL . match ( / \/ $ / ) ) {
@@ -175,8 +179,8 @@ function runRoutes() {
175179 }
176180}
177181
178- function init ( options ) {
179- options = options || { } ;
182+ function init ( options = { } ) {
183+ const { APIUrl } = options ;
180184 const controlEls = document . querySelectorAll (
181185 "[data-netlify-identity-menu],[data-netlify-identity-button]"
182186 ) ;
@@ -195,8 +199,8 @@ function init(options) {
195199 ) ;
196200 } ) ;
197201
198- store . init ( instantiateGotrue ( ) ) ;
199- if ( options . hasOwnProperty ( " logo" ) ) store . modal . logo = options . logo ;
202+ store . init ( instantiateGotrue ( APIUrl ) ) ;
203+ if ( options . logo ) store . modal . logo = options . logo ;
200204 iframe = document . createElement ( "iframe" ) ;
201205 iframe . id = "netlify-identity-widget" ;
202206 iframe . onload = ( ) => {
0 commit comments