|
- import { APICommonResponse, ApiId, HttpMethod, makeParam, request } from ".";
- import { getUrl } from "./url";
-
- export type Me = {
- customer_name: string;
- customer_name_kana: string;
- customer_name_kana_hankaku: string;
- email: string;
- zip_code: string;
- address: string;
- phone_no: string;
- customer_code: string;
- };
-
- type MeResponse = {
- data: Me;
- } & APICommonResponse;
-
- export const csrfToken = async () => {
- await request({
- url: getUrl(ApiId.CSRF_TOKEN),
- method: HttpMethod.GET,
- });
- };
-
- export const me = async () => {
- const res = await request<MeResponse>({
- url: getUrl(ApiId.ME),
- method: HttpMethod.GET,
- });
- return res;
- };
-
- export const login = async (param: { email: string; password: string }) => {
- const res = await request<MeResponse>({
- url: getUrl(ApiId.LOGIN),
- method: HttpMethod.POST,
- data: param,
- });
- return res;
- };
-
- export const logout = async () => {
- const res = await request({
- url: getUrl(ApiId.LOGOUT),
- method: HttpMethod.GET,
- });
- return res;
- };
-
- // -------パスワード設定開始---------------
- export type StartPasswordSettingRequest = {
- email: string;
- };
- export const startPasswordSetting = async (
- param: StartPasswordSettingRequest
- ) => {
- const res = await request({
- url: getUrl(ApiId.PASSWORD_SETTING_START),
- method: HttpMethod.POST,
- data: makeParam(param),
- });
- return res;
- };
-
- // -------パスワード設定認証---------------
- export type VerifyPasswordSettingRequest = {
- token: string;
- password: string;
- };
- export const verifyPasswordSetting = async (
- param: VerifyPasswordSettingRequest
- ) => {
- const res = await request({
- url: getUrl(ApiId.PASSWORD_SETTING_VERIFY),
- method: HttpMethod.POST,
- data: makeParam(param),
- });
- return res;
- };
|