Skip to content

Commit df9628d

Browse files
committed
formatting
1 parent f62b6d1 commit df9628d

File tree

3 files changed

+20
-17
lines changed

3 files changed

+20
-17
lines changed

src/classes/Auth/Auth.ts

+7-1
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,13 @@ export class Auth extends PassageBase {
7979
const { language, magicLinkPath, redirectUrl, ttl } = options || {};
8080
const response = await magicLinksApi.createMagicLink({
8181
appId: this.config.appId,
82-
createMagicLinkRequest: {...args, language, magic_link_path: magicLinkPath, redirect_url: redirectUrl, ttl },
82+
createMagicLinkRequest: {
83+
...args,
84+
language,
85+
magic_link_path: magicLinkPath,
86+
redirect_url: redirectUrl,
87+
ttl,
88+
},
8389
});
8490

8591
return response.magic_link;

src/classes/Auth/types.ts

+6-6
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,16 @@ export { MagicLinkType, MagicLink, CreateMagicLinkRequest, MagicLinkChannel } fr
55
type MagicLinkArgsBase = {
66
type: MagicLinkType;
77
send: boolean;
8-
}
8+
};
99

1010
type MagicLinkWithEmailArgs = { email: string } & MagicLinkArgsBase;
1111
type MagicLinkWithPhoneArgs = { phone: string } & MagicLinkArgsBase;
1212
type MagicLinkWithUserArgs = { userId: string; channel: MagicLinkChannel } & MagicLinkArgsBase;
1313

1414
export type CreateMagicLinkArgs = MagicLinkWithEmailArgs | MagicLinkWithPhoneArgs | MagicLinkWithUserArgs;
1515
export type MagicLinkOptions = {
16-
language?: string;
17-
magicLinkPath?: string;
18-
redirectUrl?: string;
19-
ttl?: number;
20-
};
16+
language?: string;
17+
magicLinkPath?: string;
18+
redirectUrl?: string;
19+
ttl?: number;
20+
};

src/classes/Passage/Passage.ts

+7-10
Original file line numberDiff line numberDiff line change
@@ -176,28 +176,26 @@ export class Passage {
176176
*/
177177
async createMagicLink(args: CreateMagicLinkRequest): Promise<MagicLink> {
178178
let magicLinkArgs: CreateMagicLinkArgs;
179-
if(!args.type) {
179+
if (!args.type) {
180180
throw new Error('Magic link type is required.');
181181
}
182-
if(!args.send) {
182+
if (!args.send) {
183183
throw new Error('Magic link send is required.');
184184
}
185-
if(args.email) {
185+
if (args.email) {
186186
magicLinkArgs = {
187187
email: args.email,
188188
type: args.type,
189189
send: args.send,
190190
};
191-
}
192-
else if(args.phone) {
191+
} else if (args.phone) {
193192
magicLinkArgs = {
194193
phone: args.phone,
195194
type: args.type,
196195
send: args.send ?? false,
197196
};
198-
}
199-
else if(args.user_id) {
200-
if(!args.channel) {
197+
} else if (args.user_id) {
198+
if (!args.channel) {
201199
throw new Error('Magic link channel is required when sending by user id.');
202200
}
203201
magicLinkArgs = {
@@ -206,8 +204,7 @@ export class Passage {
206204
type: args.type,
207205
send: args.send,
208206
};
209-
}
210-
else {
207+
} else {
211208
throw new Error('Either an email, phone number, or user id is required.');
212209
}
213210
const options: MagicLinkOptions = {

0 commit comments

Comments
 (0)