fix(auth, customers): Refresh page on logout and rename form field
This commit introduces two main improvements: ensuring a clean state after user logout and enhancing the clarity of the customer creation form. The logout function in the `UserContext` now calls `router.refresh()`. This forces a page reload, preventing the user from seeing stale, authenticated data after logging out. Additionally, the form field for assigning companies to a customer has been renamed from `company_ids` to `companies` in both the form component and the Zod validation schema. This refactoring improves code clarity and consistency. A related `console.log` statement was also removed.
This commit is contained in:
@@ -63,7 +63,7 @@ const CreateCustomer = ({ defaultValues, editMode, id }: IProps) => {
|
||||
: []
|
||||
}
|
||||
placeholder="Select companies to assign"
|
||||
{...register("company_ids", {
|
||||
{...register("companies", {
|
||||
required: "Please select at least one interest",
|
||||
})}
|
||||
errors={errors}
|
||||
|
||||
@@ -41,7 +41,6 @@ const useCreateCustomerPresenter = ({
|
||||
credentials: data,
|
||||
});
|
||||
} else {
|
||||
console.log(data.company_ids);
|
||||
|
||||
createCustomer({
|
||||
...data,
|
||||
|
||||
Reference in New Issue
Block a user