Add AccountProvider for account context management#3
Conversation
Implement AccountProvider to manage account state and localStorage synchronization.
|
import { NextResponse } from 'next/server'; export async function POST(request) { } catch (error) { |
|
import { NextResponse } from 'next/server'; // Create checkout session // Get the price's type from Stripe const sessionParams = { let session; if (accountId) { } else { // Redirect to the Stripe hosted checkout URL |
Implement AccountProvider to manage account state and localStorage synchronization.
'use client';
const AccountStatus = ({ accountStatus, onStartOnboarding, onLogout }) => {
if (!accountStatus) {
return null;
}
const statusColor = accountStatus.chargesEnabled ? "green" : "orange";
const statusText = accountStatus.chargesEnabled ? "Active" : "Pending";
const needsOnboarding = !accountStatus.chargesEnabled && !accountStatus.detailsSubmitted;
return (
Account Status:{" "}
<span style={{ color: statusColor }}>{statusText}
);
};
export default AccountStatus;