diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb
index 897aa46..106f07d 100644
--- a/app/controllers/application_controller.rb
+++ b/app/controllers/application_controller.rb
@@ -42,8 +42,18 @@ class ApplicationController < ActionController::Base
if owner
yield if block_given?
else
- flash[:warning] = "Operation Not Permitted"
- redirect_to root_path
+ respond_to do |format|
+ format.html do
+ flash[:warning] = "Operation Not Permitted"
+ redirect_to root_path
+ end
+
+ format.json do
+ render json: { error: "Operation Not Permitted" }, status: current_user.nil? ? :unauthorized : :forbidden
+ end
+ end
+
+
end
end
diff --git a/app/controllers/calculator_controller.rb b/app/controllers/calculator_controller.rb
index 8a714f4..85647ae 100644
--- a/app/controllers/calculator_controller.rb
+++ b/app/controllers/calculator_controller.rb
@@ -34,8 +34,10 @@ class CalculatorController < ApplicationController
begin
input_unit = UnitConversion.parse(input)
+ input_unit.unitwise
rescue UnitConversion::UnparseableUnitError => e
- data[:errors][:input] << 'invalid string'
+ data[:errors][:input] << e.message
+ input_unit = nil
end
if !input_unit.nil?
diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb
index fb0f873..cd1bf6c 100644
--- a/app/controllers/users_controller.rb
+++ b/app/controllers/users_controller.rb
@@ -50,7 +50,7 @@ class UsersController < ApplicationController
if @user.save
set_current_user(@user)
format.html { redirect_to root_path, notice: 'User created.' }
- format.json { render :show, status: :created, location: @user }
+ format.json { render json: UserSerializer.for(@user), status: :created, location: @user }
else
format.html { render :new }
format.json { render json: @user.errors, status: :unprocessable_entity }
@@ -68,7 +68,7 @@ class UsersController < ApplicationController
respond_to do |format|
if @user.update(user_params)
format.html { redirect_to root_path, notice: 'User updated.' }
- format.json { render :show, status: :created, location: @user }
+ format.json { render json: UserSerializer.for(@user) , status: :created, location: @user }
else
format.html { render :edit }
format.json { render json: @user.errors, status: :unprocessable_entity }
diff --git a/app/javascript/components/AppAutocomplete.vue b/app/javascript/components/AppAutocomplete.vue
index af5f595..7e9c922 100644
--- a/app/javascript/components/AppAutocomplete.vue
+++ b/app/javascript/components/AppAutocomplete.vue
@@ -145,7 +145,7 @@
emit("update:modelValue", newValue);
if (newValue.length >= Math.max(1, props.minLength)) {
- this.updateOptions(newValue);
+ updateOptions(newValue);
} else {
isListOpen.value = false;
}
diff --git a/app/javascript/components/AppConfirm.vue b/app/javascript/components/AppConfirm.vue
index d73946b..c59711f 100644
--- a/app/javascript/components/AppConfirm.vue
+++ b/app/javascript/components/AppConfirm.vue
@@ -1,31 +1,33 @@
-
-
-
-
-
+
+ {{ message }}
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/javascript/components/AppDatePicker.vue b/app/javascript/components/AppDatePicker.vue
index 1141547..dfd0b27 100644
--- a/app/javascript/components/AppDatePicker.vue
+++ b/app/javascript/components/AppDatePicker.vue
@@ -1,5 +1,5 @@
-
+
diff --git a/app/javascript/components/RecipeEditIngredientItem.vue b/app/javascript/components/RecipeEditIngredientItem.vue
index 74b551b..8703d15 100644
--- a/app/javascript/components/RecipeEditIngredientItem.vue
+++ b/app/javascript/components/RecipeEditIngredientItem.vue
@@ -44,55 +44,50 @@
-