@supabase/gotrue-js
Advanced tools
Comparing version 1.15.0 to 1.15.1
@@ -119,6 +119,6 @@ import { Session, Provider, UserAttributes, CookieOptions, User } from './lib/types'; | ||
* Delete an user. | ||
* @param userUID The user uid you want to remove. | ||
* @param uid The user uid you want to remove. | ||
* @param jwt A valid, logged-in JWT. | ||
*/ | ||
deleteUser(userUID: string, jwt: string): Promise<{ | ||
deleteUser(uid: string, jwt: string): Promise<{ | ||
user: User | null; | ||
@@ -125,0 +125,0 @@ data: User | null; |
@@ -209,9 +209,9 @@ "use strict"; | ||
* Delete an user. | ||
* @param userUID The user uid you want to remove. | ||
* @param uid The user uid you want to remove. | ||
* @param jwt A valid, logged-in JWT. | ||
*/ | ||
deleteUser(userUID, jwt) { | ||
deleteUser(uid, jwt) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
try { | ||
const data = yield fetch_1.remove(`${this.url}/admin/users/${userUID}`, {}, { | ||
const data = yield fetch_1.remove(`${this.url}/admin/users/${uid}`, {}, { | ||
headers: this._createRequestHeaders(jwt), | ||
@@ -218,0 +218,0 @@ }); |
@@ -104,12 +104,2 @@ import GoTrueApi from './GoTrueApi'; | ||
/** | ||
* Delete an user. | ||
*/ | ||
deleteUser({ userUID, }: { | ||
userUID: string; | ||
}): Promise<{ | ||
data: User | null; | ||
user: User | null; | ||
error: Error | null; | ||
}>; | ||
/** | ||
* Sets the session data from refresh_token and returns current Session and Error | ||
@@ -116,0 +106,0 @@ * @param refresh_token a JWT token |
@@ -197,26 +197,2 @@ "use strict"; | ||
/** | ||
* Delete an user. | ||
*/ | ||
deleteUser({ userUID, }) { | ||
var _a; | ||
return __awaiter(this, void 0, void 0, function* () { | ||
try { | ||
if (!((_a = this.currentSession) === null || _a === void 0 ? void 0 : _a.access_token)) | ||
throw new Error('Not logged in.'); | ||
const { error, user } = yield this.api.deleteUser(userUID, this.currentSession.access_token); | ||
if (error) | ||
throw error; | ||
if (!user) | ||
throw Error('Invalid user data.'); | ||
const session = Object.assign(Object.assign({}, this.currentSession), { user }); | ||
this._saveSession(session); | ||
this._notifyAllSubscribers('USER_DELETED'); | ||
return { data: user, user, error: null }; | ||
} | ||
catch (error) { | ||
return { data: null, user: null, error }; | ||
} | ||
}); | ||
} | ||
/** | ||
* Sets the session data from refresh_token and returns current Session and Error | ||
@@ -223,0 +199,0 @@ * @param refresh_token a JWT token |
@@ -119,6 +119,6 @@ import { Session, Provider, UserAttributes, CookieOptions, User } from './lib/types'; | ||
* Delete an user. | ||
* @param userUID The user uid you want to remove. | ||
* @param uid The user uid you want to remove. | ||
* @param jwt A valid, logged-in JWT. | ||
*/ | ||
deleteUser(userUID: string, jwt: string): Promise<{ | ||
deleteUser(uid: string, jwt: string): Promise<{ | ||
user: User | null; | ||
@@ -125,0 +125,0 @@ data: User | null; |
@@ -207,9 +207,9 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
* Delete an user. | ||
* @param userUID The user uid you want to remove. | ||
* @param uid The user uid you want to remove. | ||
* @param jwt A valid, logged-in JWT. | ||
*/ | ||
deleteUser(userUID, jwt) { | ||
deleteUser(uid, jwt) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
try { | ||
const data = yield remove(`${this.url}/admin/users/${userUID}`, {}, { | ||
const data = yield remove(`${this.url}/admin/users/${uid}`, {}, { | ||
headers: this._createRequestHeaders(jwt), | ||
@@ -216,0 +216,0 @@ }); |
@@ -104,12 +104,2 @@ import GoTrueApi from './GoTrueApi'; | ||
/** | ||
* Delete an user. | ||
*/ | ||
deleteUser({ userUID, }: { | ||
userUID: string; | ||
}): Promise<{ | ||
data: User | null; | ||
user: User | null; | ||
error: Error | null; | ||
}>; | ||
/** | ||
* Sets the session data from refresh_token and returns current Session and Error | ||
@@ -116,0 +106,0 @@ * @param refresh_token a JWT token |
@@ -192,26 +192,2 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
/** | ||
* Delete an user. | ||
*/ | ||
deleteUser({ userUID, }) { | ||
var _a; | ||
return __awaiter(this, void 0, void 0, function* () { | ||
try { | ||
if (!((_a = this.currentSession) === null || _a === void 0 ? void 0 : _a.access_token)) | ||
throw new Error('Not logged in.'); | ||
const { error, user } = yield this.api.deleteUser(userUID, this.currentSession.access_token); | ||
if (error) | ||
throw error; | ||
if (!user) | ||
throw Error('Invalid user data.'); | ||
const session = Object.assign(Object.assign({}, this.currentSession), { user }); | ||
this._saveSession(session); | ||
this._notifyAllSubscribers('USER_DELETED'); | ||
return { data: user, user, error: null }; | ||
} | ||
catch (error) { | ||
return { data: null, user: null, error }; | ||
} | ||
}); | ||
} | ||
/** | ||
* Sets the session data from refresh_token and returns current Session and Error | ||
@@ -218,0 +194,0 @@ * @param refresh_token a JWT token |
{ | ||
"name": "@supabase/gotrue-js", | ||
"version": "1.15.0", | ||
"version": "1.15.1", | ||
"description": "Isomorphic GoTrue client", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
@@ -247,7 +247,7 @@ import { get, post, put, remove } from './lib/fetch' | ||
* Delete an user. | ||
* @param userUID The user uid you want to remove. | ||
* @param uid The user uid you want to remove. | ||
* @param jwt A valid, logged-in JWT. | ||
*/ | ||
async deleteUser( | ||
userUID: string, | ||
uid: string, | ||
jwt: string | ||
@@ -257,3 +257,3 @@ ): Promise<{ user: User | null; data: User | null; error: Error | null }> { | ||
const data: any = await remove( | ||
`${this.url}/admin/users/${userUID}`, | ||
`${this.url}/admin/users/${uid}`, | ||
{}, | ||
@@ -260,0 +260,0 @@ { |
@@ -255,27 +255,2 @@ import GoTrueApi from './GoTrueApi' | ||
/** | ||
* Delete an user. | ||
*/ | ||
async deleteUser({ | ||
userUID, | ||
}: { | ||
userUID: string | ||
}): Promise<{ data: User | null; user: User | null; error: Error | null }> { | ||
try { | ||
if (!this.currentSession?.access_token) throw new Error('Not logged in.') | ||
const { error, user } = await this.api.deleteUser(userUID, this.currentSession.access_token) | ||
if (error) throw error | ||
if (!user) throw Error('Invalid user data.') | ||
const session = { ...this.currentSession, user } | ||
this._saveSession(session) | ||
this._notifyAllSubscribers('USER_DELETED') | ||
return { data: user, user, error: null } | ||
} catch (error) { | ||
return { data: null, user: null, error } | ||
} | ||
} | ||
/** | ||
* Sets the session data from refresh_token and returns current Session and Error | ||
@@ -308,2 +283,3 @@ * @param refresh_token a JWT token | ||
} | ||
/** | ||
@@ -310,0 +286,0 @@ * Overrides the JWT on the current client. The JWT will then be sent in all subsequent network requests. |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
237632
4279