FearArt
FearArt
NNuxt
Created by FearArt on 1/22/2025 in #❓・help
problem with setting field value from field valuec
No description
4 replies
NNuxt
Created by FearArt on 1/21/2025 in #❓・help
State Management
Can i somehow shorten this code?
const TVstate = () => {
if (openedRoom.value.hasTV === 'unknown') {
openedRoom.value.hasTV = 'Yes'
imageLibrary.value.TVImage = 'img/pngs/tv-green.png'
}
else if (openedRoom.value.hasTV === 'Yes') {
openedRoom.value.hasTV = 'No'
imageLibrary.value.TVImage = 'img/pngs/tv-red.png'
}
else {
openedRoom.value.hasTV = 'unknown'
imageLibrary.value.TVImage = 'img/pngs/tv-gray.png'
}
}
const AcessPointstate = () => {
if (openedRoom.value.hasAccessPoint === 'unknown') {
openedRoom.value.hasAccessPoint = 'Yes'
imageLibrary.value.AccessPointImage = 'img/pngs/wifi-green.png'
}
else if (openedRoom.value.hasAccessPoint === 'Yes') {
openedRoom.value.hasAccessPoint = 'No'
imageLibrary.value.AccessPointImage = 'img/pngs/wifi-red.png'
}
else {
openedRoom.value.hasAccessPoint = 'unknown'
imageLibrary.value.AccessPointImage = 'img/pngs/wifi-gray.png'
}
}
const Phonestate = () => {
if (openedRoom.value.hasPhone === 'unknown') {
openedRoom.value.hasPhone = 'Yes'
imageLibrary.value.PhoneImage = 'img/pngs/phone-green.png'
}
else if (openedRoom.value.hasPhone === 'Yes') {
openedRoom.value.hasPhone = 'No'
imageLibrary.value.PhoneImage = 'img/pngs/phone-red.png'
}
else {
openedRoom.value.hasPhone = 'unknown'
imageLibrary.value.PhoneImage = 'img/pngs/phone-gray.png'
}
}
const BathPhonestate = () => {
if (openedRoom.value.hasBathPhone === 'unknown') {
openedRoom.value.hasBathPhone = 'Yes'
imageLibrary.value.BathPhoneImage = 'img/pngs/bath-green.png'
}
else if (openedRoom.value.hasBathPhone === 'Yes') {
openedRoom.value.hasBathPhone = 'No'
imageLibrary.value.BathPhoneImage = 'img/pngs/bath-red.png'
}
else {
openedRoom.value.hasBathPhone = 'unknown'
imageLibrary.value.BathPhoneImage = 'img/pngs/bath-gray.png'
}
}
const TVstate = () => {
if (openedRoom.value.hasTV === 'unknown') {
openedRoom.value.hasTV = 'Yes'
imageLibrary.value.TVImage = 'img/pngs/tv-green.png'
}
else if (openedRoom.value.hasTV === 'Yes') {
openedRoom.value.hasTV = 'No'
imageLibrary.value.TVImage = 'img/pngs/tv-red.png'
}
else {
openedRoom.value.hasTV = 'unknown'
imageLibrary.value.TVImage = 'img/pngs/tv-gray.png'
}
}
const AcessPointstate = () => {
if (openedRoom.value.hasAccessPoint === 'unknown') {
openedRoom.value.hasAccessPoint = 'Yes'
imageLibrary.value.AccessPointImage = 'img/pngs/wifi-green.png'
}
else if (openedRoom.value.hasAccessPoint === 'Yes') {
openedRoom.value.hasAccessPoint = 'No'
imageLibrary.value.AccessPointImage = 'img/pngs/wifi-red.png'
}
else {
openedRoom.value.hasAccessPoint = 'unknown'
imageLibrary.value.AccessPointImage = 'img/pngs/wifi-gray.png'
}
}
const Phonestate = () => {
if (openedRoom.value.hasPhone === 'unknown') {
openedRoom.value.hasPhone = 'Yes'
imageLibrary.value.PhoneImage = 'img/pngs/phone-green.png'
}
else if (openedRoom.value.hasPhone === 'Yes') {
openedRoom.value.hasPhone = 'No'
imageLibrary.value.PhoneImage = 'img/pngs/phone-red.png'
}
else {
openedRoom.value.hasPhone = 'unknown'
imageLibrary.value.PhoneImage = 'img/pngs/phone-gray.png'
}
}
const BathPhonestate = () => {
if (openedRoom.value.hasBathPhone === 'unknown') {
openedRoom.value.hasBathPhone = 'Yes'
imageLibrary.value.BathPhoneImage = 'img/pngs/bath-green.png'
}
else if (openedRoom.value.hasBathPhone === 'Yes') {
openedRoom.value.hasBathPhone = 'No'
imageLibrary.value.BathPhoneImage = 'img/pngs/bath-red.png'
}
else {
openedRoom.value.hasBathPhone = 'unknown'
imageLibrary.value.BathPhoneImage = 'img/pngs/bath-gray.png'
}
}
5 replies
NNuxt
Created by FearArt on 11/30/2024 in #❓・help
useCookie returns undefined
No description
6 replies
NNuxt
Created by FearArt on 11/25/2024 in #❓・help
Import error
i have 2 absolutely identical mongoose model definitions, but one is causing errors and other - don't
import { defineMongooseModel } from "#nuxt/mongoose";

export const User = defineMongooseModel({
name: 'User',
schema: {
DiscordId : {
type: 'string',
required: true,
unique: true,
},
NickName: {
type: 'string',
required: true,
unique: true,
},
StaticId: {
type: 'string',
required: true,
unique: true,
},
Fraction: {
type: 'string',
required: false,
},
Status: {
type: 'string',
required: false,
},
Warns : {
type: Number,
required: false,
},
Rank : {
type: Number,
required: false,
},
}
})
import { defineMongooseModel } from "#nuxt/mongoose";

export const User = defineMongooseModel({
name: 'User',
schema: {
DiscordId : {
type: 'string',
required: true,
unique: true,
},
NickName: {
type: 'string',
required: true,
unique: true,
},
StaticId: {
type: 'string',
required: true,
unique: true,
},
Fraction: {
type: 'string',
required: false,
},
Status: {
type: 'string',
required: false,
},
Warns : {
type: Number,
required: false,
},
Rank : {
type: Number,
required: false,
},
}
})
import { defineMongooseModel } from "#nuxt/mongoose";

export const LogModel = defineMongooseModel({
name: 'Log',
schema: {
initiator: {
type: Object,
required: true,
},
target: {
type: Object,
required: true,
},
reason: 'string',
argument: 'string',
logType: 'string',
date: Date
}
})
import { defineMongooseModel } from "#nuxt/mongoose";

export const LogModel = defineMongooseModel({
name: 'Log',
schema: {
initiator: {
type: Object,
required: true,
},
target: {
type: Object,
required: true,
},
reason: 'string',
argument: 'string',
logType: 'string',
date: Date
}
})
It says: https://i.imgur.com/H0wN4Sz.png so basically it's smth with imports
14 replies
NNuxt
Created by FearArt on 11/22/2024 in #❓・help
Using JWT in middleware
No description
11 replies
NNuxt
Created by FearArt on 9/1/2024 in #❓・help
Shitcode Fix
Hi, im kinda new to nuxt (( as for any JS/TS proj, im solo-learn-dev)) , and as my project evolved, i had to create a lot of things thats not best way to do things accoring to cleancode and perfomance. So now i'm with this : https://mystb.in/281e79ff05e9c1e372 and i have to deal with it, really would appreciate any info how can i minimize code, remove repeatabilty and other cleancode features Full project (( please don't kill me )) : https://github.com/fearart/hotel-viewer
2 replies