Skip to content

Commit

Permalink
Merge branch 'develop' of https://github.com/credebl/studio into fix-…
Browse files Browse the repository at this point in the history
…forbidden-resource-error
  • Loading branch information
sanjay-k1910 committed Nov 20, 2023
2 parents b345148 + 29761d5 commit 7a27428
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/api/Auth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -199,12 +199,20 @@ export const getFromLocalStorage = async (key: string) =>{
return convertedValue
}

export const setToCookies = (cookies: AstroCookies, key: string, value: any, option: {}) =>{
export const setToCookies = (cookies: AstroCookies, key: string, value: any, option: {[key: string]: any }) =>{
if(!value.trim()){
return
}
const convertedValue = encryptData(value)
cookies.set(key, convertedValue as string, option)
// Set HttpOnly, Secure, and SameSite attributes in the options
const updatedOption: { [key: string]: any }= {
...option,
httpOnly: true,
secure: true, // Set to true if using HTTPS
sameSite: 'Strict',
};
cookies.set(key, convertedValue as string, updatedOption)

return true
}

Expand Down

0 comments on commit 7a27428

Please sign in to comment.