94 lines
19 KiB
Plaintext
94 lines
19 KiB
Plaintext
import api from "/src/api/index.ts";
|
|||
|
|
export const authApi = {
|
||
|
|
/**
|
||
|
|
* `sendVerificationCode` API call. Use this method from the page script to invoke the backend endpoint tied to this feature.
|
||
|
|
* Call guide: supply the parameters below, await the returned Promise, and handle loading / error UI in the caller.
|
||
|
|
* @param data: SendVerificationCodeRequest caller-supplied value for `data: SendVerificationCodeRequest`
|
||
|
|
*/
|
||
|
|
sendVerificationCode: (data) => {
|
||
|
|
return api.post("/user/send-verification-code", data);
|
||
|
|
},
|
||
|
|
/**
|
||
|
|
* `login` API call. Use this method from the page script to invoke the backend endpoint tied to this feature.
|
||
|
|
* Call guide: supply the parameters below, await the returned Promise, and handle loading / error UI in the caller.
|
||
|
|
* @param data: LoginRequest caller-supplied value for `data: LoginRequest`
|
||
|
|
*/
|
||
|
|
login: (data) => {
|
||
|
|
return api.post("/user/login", data);
|
||
|
|
},
|
||
|
|
/**
|
||
|
|
* `phoneLogin` API call. Use this method from the page script to invoke the backend endpoint tied to this feature.
|
||
|
|
* Call guide: supply the parameters below, await the returned Promise, and handle loading / error UI in the caller.
|
||
|
|
* @param data: PhoneLoginRequest caller-supplied value for `data: PhoneLoginRequest`
|
||
|
|
*/
|
||
|
|
phoneLogin: (data) => {
|
||
|
|
return api.post("/user/phone-login", data);
|
||
|
|
},
|
||
|
|
/**
|
||
|
|
* `adminLogin` API call. Use this method from the page script to invoke the backend endpoint tied to this feature.
|
||
|
|
* Call guide: supply the parameters below, await the returned Promise, and handle loading / error UI in the caller.
|
||
|
|
* @param data: LoginRequest caller-supplied value for `data: LoginRequest`
|
||
|
|
*/
|
||
|
|
adminLogin: (data) => {
|
||
|
|
return api.post("/admin/auth/login", data);
|
||
|
|
},
|
||
|
|
/**
|
||
|
|
* `register` API call. Use this method from the page script to invoke the backend endpoint tied to this feature.
|
||
|
|
* Call guide: supply the parameters below, await the returned Promise, and handle loading / error UI in the caller.
|
||
|
|
* @param data: RegisterRequest caller-supplied value for `data: RegisterRequest`
|
||
|
|
*/
|
||
|
|
register: (data) => {
|
||
|
|
return api.post("/user/register", data);
|
||
|
|
},
|
||
|
|
/**
|
||
|
|
* `refreshToken` API call. Use this method from the page script to invoke the backend endpoint tied to this feature.
|
||
|
|
* Call guide: supply the parameters below, await the returned Promise, and handle loading / error UI in the caller.
|
||
|
|
* @param data: RefreshTokenRequest caller-supplied value for `data: RefreshTokenRequest`
|
||
|
|
*/
|
||
|
|
refreshToken: (data) => {
|
||
|
|
return api.post("/user/refresh-token", data);
|
||
|
|
},
|
||
|
|
/**
|
||
|
|
* `logout` API call. Use this method from the page script to invoke the backend endpoint tied to this feature.
|
||
|
|
* Call guide: supply the parameters below, await the returned Promise, and handle loading / error UI in the caller.
|
||
|
|
*/
|
||
|
|
logout: () => {
|
||
|
|
return api.post("/user/logout");
|
||
|
|
},
|
||
|
|
/**
|
||
|
|
* `switchShop` API call. Use this method from the page script to invoke the backend endpoint tied to this feature.
|
||
|
|
* Call guide: supply the parameters below, await the returned Promise, and handle loading / error UI in the caller.
|
||
|
|
* @param data: SwitchShopRequest caller-supplied value for `data: SwitchShopRequest`
|
||
|
|
*/
|
||
|
|
switchShop: (data) => {
|
||
|
|
return api.post("/user/switch-shop", data);
|
||
|
|
},
|
||
|
|
/**
|
||
|
|
* `getUserInfo` API call. Use this method from the page script to invoke the backend endpoint tied to this feature.
|
||
|
|
* Call guide: supply the parameters below, await the returned Promise, and handle loading / error UI in the caller.
|
||
|
|
*/
|
||
|
|
getUserInfo: () => {
|
||
|
|
return api.get("/user/info");
|
||
|
|
},
|
||
|
|
/**
|
||
|
|
* `resetPasswordByPhone` API call. Use this method from the page script to invoke the backend endpoint tied to this feature.
|
||
|
|
* Call guide: supply the parameters below, await the returned Promise, and handle loading / error UI in the caller.
|
||
|
|
* @param data: ResetPasswordRequest caller-supplied value for `data: ResetPasswordRequest`
|
||
|
|
*/
|
||
|
|
resetPasswordByPhone: (data) => {
|
||
|
|
return api.post("/user/reset-password-by-phone", data);
|
||
|
|
}
|
||
|
|
};
|
||
|
|
export const legalAgreementApi = {
|
||
|
|
listCurrent: () => {
|
||
|
|
return api.get("/legal-agreement/current");
|
||
|
|
},
|
||
|
|
getCurrent: (type) => {
|
||
|
|
return api.get(`/legal-agreement/current/${type}`);
|
||
|
|
},
|
||
|
|
getMyConsent: () => {
|
||
|
|
return api.get("/user/agreement-consent/me");
|
||
|
|
}
|
||
|
|
};
|
||
|
|
|
||
|
|
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImF1dGgudHMiXSwic291cmNlc0NvbnRlbnQiOlsiLyoqXG4gKiBGcm9udC1lbmQgQVBJIHdyYXBwZXIgZm9yIHRoaXMgbW9kdWxlLlxuICogQ2FsbCBndWlkZTogaW1wb3J0IHRoZSBuYW1lZCBBUEkgb2JqZWN0LCB0aGVuIGNhbGwgdGhlIG1hdGNoaW5nIG1ldGhvZCBmcm9tIGEgVnVlIHBhZ2Ugb3IgY29tcG9zYWJsZS5cbiAqL1xuaW1wb3J0IGFwaSBmcm9tICcuL2luZGV4J1xuaW1wb3J0IHR5cGUgeyBJZFR5cGUgfSBmcm9tICdAL3V0aWxzL2lkJ1xuXG4vKipcbiAqIFB1cnBvc2U6IFNlbmRWZXJpZmljYXRpb25Db2RlUmVxdWVzdCBzdXBwb3J0cyBhdXRoLnRzIGJ5IGhvbGRpbmcgb3IgZXhlY3V0aW5nIHRoZSBzZW5kIHZlcmlmaWNhdGlvbiBjb2RlIHJlcXVlc3QgcGFnZSBvciBBUEkgcm9sZS5cbiAqIFVzYWdlOiBpbXBvcnQsIGNhbGwsIHJlYWQsIG9yIHVwZGF0ZSB0aGlzIGludGVyZmFjZSBmcm9tIHRoZSBvd25pbmcgcGFnZS9tb2R1bGUgd2hpbGUgcHJlc2VydmluZyB0aGUgc3Vycm91bmRpbmcgbG9hZGluZyBhbmQgcGVybWlzc2lvbiBmbG93LlxuICovXG5leHBvcnQgaW50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