Files
cozsweet-frontend-nextjs/src/data/storage/payment/payment_plans_storage.ts
T

34 lines
830 B
TypeScript

"use client";
import {
PaymentPlansResponseSchema,
type PaymentPlansResponseData,
} from "@/data/schemas/payment";
import { type Result as ResultT } from "@/utils/result";
import { SpAsyncUtil } from "@/utils/storage";
import { StorageKeys } from "../storage_keys";
export class PaymentPlansStorage {
private constructor() {}
static getPlans(): Promise<ResultT<PaymentPlansResponseData | null>> {
return SpAsyncUtil.getJson(
StorageKeys.paymentPlans,
PaymentPlansResponseSchema,
);
}
static setPlans(plans: PaymentPlansResponseData): Promise<ResultT<void>> {
return SpAsyncUtil.setJson(
StorageKeys.paymentPlans,
plans,
PaymentPlansResponseSchema,
);
}
static clearPlans(): Promise<ResultT<void>> {
return SpAsyncUtil.remove(StorageKeys.paymentPlans);
}
}