Skip to content

Commit 596f6e8

Browse files
committed
⚰️(frontend) remove Address from joanieLegacy
1 parent a3e9e7d commit 596f6e8

File tree

3 files changed

+1
-59
lines changed

3 files changed

+1
-59
lines changed

src/frontend/js/api/joanie/joanieLegacyClient.ts

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -283,25 +283,6 @@ const API = (): Joanie.API => {
283283
method: 'DELETE',
284284
}).then(checkStatus),
285285
},
286-
addresses: {
287-
get: (id?: string) => {
288-
return fetchWithJWT(buildApiUrl(ROUTES.user.addresses.get, { id })).then(checkStatus);
289-
},
290-
create: async (payload) =>
291-
fetchWithJWT(ROUTES.user.addresses.create, {
292-
method: 'POST',
293-
body: JSON.stringify(payload),
294-
}).then(checkStatus),
295-
update: async ({ id, ...address }) =>
296-
fetchWithJWT(ROUTES.user.addresses.update.replace(':id', id), {
297-
method: 'PUT',
298-
body: JSON.stringify(address),
299-
}).then(checkStatus),
300-
delete: async (id) =>
301-
fetchWithJWT(ROUTES.user.addresses.delete.replace(':id', id), {
302-
method: 'DELETE',
303-
}).then(checkStatus),
304-
},
305286
orders: {
306287
abort: async ({ id, payment_id }) => {
307288
return fetchWithJWT(ROUTES.user.orders.abort.replace(':id', id), {

src/frontend/js/types/Joanie.ts

Lines changed: 1 addition & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -372,19 +372,6 @@ export interface CreditCard {
372372
title?: string;
373373
}
374374

375-
// Address
376-
export interface Address {
377-
address: string;
378-
city: string;
379-
country: string;
380-
first_name: string;
381-
last_name: string;
382-
id: string;
383-
is_main: boolean;
384-
postcode: string;
385-
title: string;
386-
}
387-
388375
// Wishlist
389376
export interface CourseWish extends Resource {
390377
status: boolean;
@@ -415,10 +402,6 @@ export interface OrderPaymentInfo {
415402
}
416403

417404
// - API
418-
export interface AddressCreationPayload extends Omit<Address, 'id' | 'is_main'> {
419-
is_main?: boolean;
420-
}
421-
422405
interface AbstractOrderProductCreationPayload {
423406
product_id: Product['id'];
424407
order_group_id?: OrderGroup['id'];
@@ -441,7 +424,7 @@ interface OrderAbortPayload {
441424

442425
interface OrderSubmitPayload {
443426
id: Order['id'];
444-
billing_address: Omit<Address, 'id' | 'is_main'>;
427+
billing_address: Omit<AddressGen, 'id' | 'is_main'>;
445428
credit_card_id?: CreditCard['id'];
446429
}
447430

@@ -525,13 +508,6 @@ interface APIUser {
525508
me: {
526509
get(): Promise<JoanieUserProfile>;
527510
};
528-
addresses: {
529-
create(payload: AddressCreationPayload): Promise<Address>;
530-
delete(id: Address['id']): Promise<void>;
531-
get(id: Address['id']): Promise<Address>;
532-
get(): Promise<Address[]>;
533-
update(payload: Address): Promise<Address>;
534-
};
535511
creditCards: {
536512
create(payload: Omit<CreditCard, 'id'>): Promise<CreditCard>;
537513
delete(id: CreditCard['id']): Promise<void>;

src/frontend/js/utils/test/factories/joanieLegacy.ts

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import { faker } from '@faker-js/faker';
22
import { CourseStateTextEnum, Priority } from 'types';
33
import {
4-
Address,
54
Certificate,
65
CertificateDefinition,
76
CourseListItem,
@@ -464,20 +463,6 @@ export const CertificateOrderWithOneClickPaymentFactory = factory(
464463
},
465464
);
466465

467-
export const AddressFactory = factory((): Address => {
468-
return {
469-
address: faker.location.streetAddress(),
470-
city: faker.location.city(),
471-
country: faker.location.countryCode(),
472-
first_name: faker.person.firstName(),
473-
last_name: faker.person.lastName(),
474-
id: faker.string.uuid(),
475-
is_main: false,
476-
postcode: faker.location.zipCode(),
477-
title: FactoryHelper.sequence((counter) => `Address ${counter}`),
478-
};
479-
});
480-
481466
export const CreditCardFactory = factory((): CreditCard => {
482467
return {
483468
brand: CreditCardBrand.VISA,

0 commit comments

Comments
 (0)